diff --git a/docs/source/algorithms/Logarithm-v1.rst b/docs/source/algorithms/Logarithm-v1.rst
index 7515ff5ad49bc0adfb3a8b521888761d23e16455..f73ddf933f3756df35825266d255e2d75aefb3cb 100644
--- a/docs/source/algorithms/Logarithm-v1.rst
+++ b/docs/source/algorithms/Logarithm-v1.rst
@@ -33,19 +33,20 @@ Usage
 
 .. testcode:: ExLogarithm
 
-    dataX = range(0,10)*10 # define 10 x-spectra
+    dataX = list(range(0,10))*10 # define 10 x-spectra
     dataY =([1]*10)*10     # with values 1
     dataY[0]=-10           # make first value not suitable for logarithm
     dataY[1]=10            # make second value different
     dataE =([1]*10)*10     # define 10 error spectra with value 1
     # create test workspace
-    ws = CreateWorkspace(dataX, dataY,dataE,NSpec=10)
-    # caluclate log10
+    ws = CreateWorkspace(dataX, dataY, dataE, NSpec=10)
+    # Calculate log10
     ws = Logarithm(ws,Filler=-1,Natural='0')
     #
     # check results:
-    print 'Log10 for spectra 0: ',ws.readY(0)
-    print 'Log10 for Err spectra 0: ',ws.readE(0)[0:4]    
+
+    print('Log10 for spectra 0:  {}'.format(ws.readY(0)))
+    print('Log10 for Err spectra 0:  {}'.format(ws.readE(0)[0:4]))
     
 .. testcleanup:: ExLogarithm
 
diff --git a/docs/source/algorithms/LorentzCorrection-v1.rst b/docs/source/algorithms/LorentzCorrection-v1.rst
index 626c5e5cc385267fe544896a03eb0d0040f57273..509cdbc732430d80b4da324404cd923af2eff451 100644
--- a/docs/source/algorithms/LorentzCorrection-v1.rst
+++ b/docs/source/algorithms/LorentzCorrection-v1.rst
@@ -33,9 +33,9 @@ Usage
    y = corrected.readY(2)
    e = corrected.readE(2)
    # print first corrected yvalues
-   print y[1:5]
+   print(y[1:5])
    # print first corrected evalues
-   print e[1:5]
+   print(e[1:5])
 
 Output:
 
diff --git a/docs/source/algorithms/MDHistoToWorkspace2D-v1.rst b/docs/source/algorithms/MDHistoToWorkspace2D-v1.rst
index 2eed6b1753b1a3f364b0aa55c83faddbe69ffa99..90c4d1cd41dbb2bb614b234301d766c88a90171e 100644
--- a/docs/source/algorithms/MDHistoToWorkspace2D-v1.rst
+++ b/docs/source/algorithms/MDHistoToWorkspace2D-v1.rst
@@ -35,8 +35,8 @@ Usage
    output = MDHistoToWorkspace2D(InputWorkspace='input')
 
    # print 6th group of 4 bins in both input and output workspaces
-   print "part of MD workspace",input.getSignalArray()[1,1]
-   print "corresponding part of 2D workspace",output.dataY(5) 
+   print("part of MD workspace {}".format(input.getSignalArray()[1,1]))
+   print("corresponding part of 2D workspace {}".format(output.dataY(5) ))
 
 Output:
 
diff --git a/docs/source/algorithms/MaskAngle-v1.rst b/docs/source/algorithms/MaskAngle-v1.rst
index 9452eccdf4786ee176bb2a122b97072e4b2727d6..5f9590342acbae50c7c3b200635aaaf7e8c1a826 100644
--- a/docs/source/algorithms/MaskAngle-v1.rst
+++ b/docs/source/algorithms/MaskAngle-v1.rst
@@ -22,17 +22,17 @@ Usage
 .. testcode:: MaskAngle
 
     #Load a workspace
-    ws=Load("CNCS_7860")
+    ws = Load("CNCS_7860")
     
     #Do the masking for direct beam
-    mask=MaskAngle(ws,MinAngle=0,MaxAngle=10)
-    print "The algorithm has masked ",mask.size," detectors"
+    mask = MaskAngle(ws, MinAngle=0, MaxAngle=10)
+    print("The algorithm has masked {} detectors".format(mask.size))
     
     #to test check a couple of detectors
-    inst=ws.getInstrument()
-    print "Is the minimum element in the mask list (detector ",mask.min(),") masked? ",inst.getDetector(int(mask.min())).isMasked()   
-    print "Is the maximum element in the mask list (detector ",mask.max(),") masked? ",inst.getDetector(int(mask.max())).isMasked() 
-    print "Is a detector outside the list masked (for example detector 100)? ", inst.getDetector(100).isMasked()  
+    inst = ws.getInstrument()
+    print("Is the minimum element in the mask list (detector {}) masked?  {}".format(mask.min(), inst.getDetector(int(mask.min())).isMasked()))
+    print("Is the maximum element in the mask list (detector {}) masked?  {}".format(mask.max(), inst.getDetector(int(mask.max())).isMasked()))
+    print("Is a detector outside the list masked (for example detector 100)?  {}".format(inst.getDetector(100).isMasked()  ))
 
 .. testcleanup:: MaskAngle
 
@@ -42,9 +42,9 @@ Output:
 
 .. testoutput:: MaskAngle
 
-    The algorithm has masked  1516  detectors
-    Is the minimum element in the mask list (detector  35126 ) masked?  True
-    Is the maximum element in the mask list (detector  38601 ) masked?  True
+    The algorithm has masked 1516 detectors
+    Is the minimum element in the mask list (detector 35126) masked?  True
+    Is the maximum element in the mask list (detector 38601) masked?  True
     Is a detector outside the list masked (for example detector 100)?  False
 
 
diff --git a/docs/source/algorithms/MaskBTP-v1.rst b/docs/source/algorithms/MaskBTP-v1.rst
index 05b2a47ad34a25516f3d0733f2fa236c7f48c822..611797be603c41b44e8c415b218a8d80e7e0c63f 100644
--- a/docs/source/algorithms/MaskBTP-v1.rst
+++ b/docs/source/algorithms/MaskBTP-v1.rst
@@ -41,19 +41,19 @@ Usage
     a=MaskBTP(Instrument='CNCS',Tube='1-3')
     b=MaskBTP(Workspace='CNCSMaskBTP',Instrument='CNCS',Bank='40-50',Pixel='1-10')
     c=MaskBTP(Workspace='CNCSMaskBTP',Instrument='CNCS',Bank='42')
-    print "Detectors masked"
-    print "Step 1: 50 * 3 * 128 =", a.size
-    print "Step 2: 11 * 8 * 10 =", b.size
-    print "Step 3: 1 * 8 * 128 =", c.size
+    print("Detectors masked")
+    print("Step 1: 50 * 3 * 128 = {0.size}".format(a))
+    print("Step 2: 11 * 8 * 10 = {0.size}".format(b))
+    print("Step 3: 1 * 8 * 128 = {0.size}".format(c))
 
-    print "Here are some of the masked detectors:"
+    print("Here are some of the masked detectors:")
     instrument=mtd['CNCSMaskBTP'].getInstrument()
-    print "A pixel Bank 42, detector 42700: ",instrument.getDetector(42700).isMasked()
-    print "Pixel 1 in Tube 4 in Bank 45, detector 45440: ",instrument.getDetector(45440).isMasked()
-    print "Pixel 100 in Tube 2 in Bank 45, detector 45283: ",instrument.getDetector(45283).isMasked()
-    print
-    print "And one that should not be masked"
-    print "Pixel 128 in Tube 8 in Bank 50, detector 51199: ",instrument.getDetector(51199).isMasked()
+    print("A pixel Bank 42, detector 42700:  {}".format(instrument.getDetector(42700).isMasked()))
+    print("Pixel 1 in Tube 4 in Bank 45, detector 45440:  {}".format(instrument.getDetector(45440).isMasked()))
+    print("Pixel 100 in Tube 2 in Bank 45, detector 45283:  {}".format(instrument.getDetector(45283).isMasked()))
+    print("")
+    print("And one that should not be masked")
+    print("Pixel 128 in Tube 8 in Bank 50, detector 51199:  {}".format(instrument.getDetector(51199).isMasked()))
 
 .. testcleanup:: MaskBTP
 
diff --git a/docs/source/algorithms/MaskBins-v1.rst b/docs/source/algorithms/MaskBins-v1.rst
index 9978adbf23ee0177cc42ed68e9e05b1ef5cc89be..cbdeb1a00b168973176d157458e8f37584b84ef1 100644
--- a/docs/source/algorithms/MaskBins-v1.rst
+++ b/docs/source/algorithms/MaskBins-v1.rst
@@ -38,8 +38,8 @@ Usage
    wsMasked = MaskBins(ws,XMin=16,XMax=32)
 
    # Show Y values in workspaces
-   print "Before masking:", ws.readY(0)
-   print "After masking:",wsMasked.readY(0)
+   print("Before masking: {}".format(ws.readY(0)))
+   print("After masking: {}".format(wsMasked.readY(0)))
 
 
 Output:
diff --git a/docs/source/algorithms/MaskBinsFromTable-v1.rst b/docs/source/algorithms/MaskBinsFromTable-v1.rst
index f0a4ef4c14254478d5439bf79dbfde8ba8284244..8ee464a6408329a145244fd543b6e02776d924d3 100644
--- a/docs/source/algorithms/MaskBinsFromTable-v1.rst
+++ b/docs/source/algorithms/MaskBinsFromTable-v1.rst
@@ -41,8 +41,8 @@ Usage
    wsMasked = MaskBinsFromTable(ws,MaskingInformation=mask_info)
 
    # Show Y values in workspaces
-   print "Before masking:", ws.readY(0)
-   print "After masking:",wsMasked.readY(0)
+   print("Before masking: {}".format(ws.readY(0)))
+   print("After masking: {}".format(wsMasked.readY(0)))
 
 
 Output:
diff --git a/docs/source/algorithms/MaskDetectors-v1.rst b/docs/source/algorithms/MaskDetectors-v1.rst
index 33b63ac1ca8117bb79c92f4724c41578d51e2042..b22bb7a85abaaa4d2c0aaba94ebfa121c7b33047 100644
--- a/docs/source/algorithms/MaskDetectors-v1.rst
+++ b/docs/source/algorithms/MaskDetectors-v1.rst
@@ -22,14 +22,14 @@ always returns first spectra present in the workspace.
 
 The *Spectra Number* or  *spectra ID* mean the number, assigned to a spectrum. This number is often equal to *WorkspaceIndex+1*, e.g. ::
 
-  print sp.getSpectrumNo() 
+  print(sp.getSpectrumNo())
 
 from the sample above will often print 1 but not always. The simplest case when this 
 number is different is when you load a second half of a workspace, when the first spectrum number still is **NumTotalSpectraInWorkspace/2+1**,
 while *WorkspaceIndex* of this spectra becomes 0, i.e.: ::
 
 	sp = ws.getSpectrum(0)
-	print sp.getSpectrumNo()
+	print(sp.getSpectrumNo())
 	
 prints number equal to **NumTotalSpectraInWorkspace/2+1**. There are other ways to assign a random number to a spectrum. 
 
@@ -38,8 +38,8 @@ a  first detector corresponds to the first spectra of a workspace, but it is not
 the code: ::
 
   ws = CreateSimulationWorkspace('MARI','-0.5,0.5,0.5')
-  sp=ws.getSpectrum(1)
-  print sp.getSpectrumNo(), sp.getDetectorIDs()
+  sp = ws.getSpectrum(1)
+  print("{} {}".format(sp.getSpectrumNo(), sp.getDetectorIDs()))
 
 Will print: ::
 
@@ -190,34 +190,34 @@ Example 1: specifying spectrum numbers
   # Get the 1st spectrum in the workspace
   spec = ws.getSpectrum(0)
   detid = spec.getDetectorIDs()[0]
-  print 'Spectrum number is',spec.getSpectrumNo()
-  print 'Detector of this spectrum is masked:',ws.getInstrument().getDetector(detid).isMasked()
+  print('Spectrum number is {}'.format(spec.getSpectrumNo()))
+  print('Detector of this spectrum is masked: {}'.format(ws.getInstrument().getDetector(detid).isMasked()))
   y = ws.readY(0)
-  print 'All counts in the spectrum are 0:   ',np.all( y == 0.0 )
+  print('All counts in the spectrum are 0:    {}'.format(np.all( y == 0.0 )))
 
   # Get the 2nd spectrum in the workspace
   spec = ws.getSpectrum(1)
   detid = spec.getDetectorIDs()[0]
-  print 'Spectrum number is',spec.getSpectrumNo()
-  print 'Detector of this spectrum is masked:',ws.getInstrument().getDetector(detid).isMasked()
+  print('Spectrum number is {}'.format(spec.getSpectrumNo()))
+  print('Detector of this spectrum is masked: {}'.format(ws.getInstrument().getDetector(detid).isMasked()))
   y = ws.readY(1)
-  print 'All counts in the spectrum are 0:   ',np.all( y == 0.0 )
+  print('All counts in the spectrum are 0:    {}'.format(np.all( y == 0.0 )))
 
   # Get the 3rd spectrum in the workspace
   spec = ws.getSpectrum(2)
   detid = spec.getDetectorIDs()[0]
-  print 'Spectrum number is',spec.getSpectrumNo()
-  print 'Detector of this spectrum is masked:',ws.getInstrument().getDetector(detid).isMasked()
+  print('Spectrum number is {}'.format(spec.getSpectrumNo()))
+  print('Detector of this spectrum is masked: {}'.format(ws.getInstrument().getDetector(detid).isMasked()))
   y = ws.readY(2)
-  print 'All counts in the spectrum are 0:   ',np.all( y == 0.0 )
+  print('All counts in the spectrum are 0:    {}'.format(np.all( y == 0.0 )))
 
   # Get the 4th spectrum in the workspace
   spec = ws.getSpectrum(3)
   detid = spec.getDetectorIDs()[0]
-  print 'Spectrum number is',spec.getSpectrumNo()
-  print 'Detector of this spectrum is masked:',ws.getInstrument().getDetector(detid).isMasked()
+  print('Spectrum number is {}'.format(spec.getSpectrumNo()))
+  print('Detector of this spectrum is masked: {}'.format(ws.getInstrument().getDetector(detid).isMasked()))
   y = ws.readY(3)
-  print 'All counts in the spectrum are 0:   ',np.all( y == 0.0 )
+  print('All counts in the spectrum are 0:    {}'.format(np.all( y == 0.0 )))
 
 Output
 ^^^^^^
@@ -252,19 +252,19 @@ Example 2: specifying detector IDs
 
   # Check the 1st detector
   det = ws.getInstrument().getDetector(101)
-  print 'Detector ',det.getID(),' is masked:',det.isMasked()
+  print('Detector  {}  is masked: {}'.format(det.getID(), det.isMasked()))
 
   # Check the 2nd detector
   det = ws.getInstrument().getDetector(103)
-  print 'Detector ',det.getID(),' is masked:',det.isMasked()
+  print('Detector  {}  is masked: {}'.format(det.getID(), det.isMasked()))
 
   # Check some other detectors
   det = ws.getInstrument().getDetector(100)
-  print 'Detector ',det.getID(),' is masked:',det.isMasked()
+  print('Detector  {}  is masked: {}'.format(det.getID(), det.isMasked()))
   det = ws.getInstrument().getDetector(102)
-  print 'Detector ',det.getID(),' is masked:',det.isMasked()
+  print('Detector  {}  is masked: {}'.format(det.getID(), det.isMasked()))
   det = ws.getInstrument().getDetector(105)
-  print 'Detector ',det.getID(),' is masked:',det.isMasked()
+  print('Detector  {}  is masked: {}'.format(det.getID(), det.isMasked()))
 
 Output
 ^^^^^^
@@ -293,23 +293,23 @@ Example 3: specifying workspace indices
   # Check the 1st spectrum
   workspaceIndex = 0
   det = ws.getDetector( workspaceIndex )
-  print 'Detector in spectrum with workspace index ',workspaceIndex,' is masked:',det.isMasked()
+  print('Detector in spectrum with workspace index  {}  is masked: {}'.format(workspaceIndex, det.isMasked()))
 
   # Check the 2nd spectrum
   workspaceIndex = 2
   det = ws.getDetector( workspaceIndex )
-  print 'Detector in spectrum with workspace index ',workspaceIndex,' is masked:',det.isMasked()
+  print('Detector in spectrum with workspace index  {}  is masked: {}'.format(workspaceIndex, det.isMasked()))
 
   # Check some other spectra
   workspaceIndex = 1
   det = ws.getDetector( workspaceIndex )
-  print 'Detector in spectrum with workspace index ',workspaceIndex,' is masked:',det.isMasked()
+  print('Detector in spectrum with workspace index  {}  is masked: {}'.format(workspaceIndex, det.isMasked()))
   workspaceIndex = 3
   det = ws.getDetector( workspaceIndex )
-  print 'Detector in spectrum with workspace index ',workspaceIndex,' is masked:',det.isMasked()
+  print('Detector in spectrum with workspace index  {}  is masked: {}'.format(workspaceIndex, det.isMasked()))
   workspaceIndex = 4
   det = ws.getDetector( workspaceIndex )
-  print 'Detector in spectrum with workspace index ',workspaceIndex,' is masked:',det.isMasked()
+  print('Detector in spectrum with workspace index  {}  is masked: {}'.format(workspaceIndex, det.isMasked()))
 
 Output
 ^^^^^^
@@ -375,13 +375,13 @@ Example 5: specifying a masking workspace
   # Extract created mask into specialised masking workspace
   masking_ws,dummy = ExtractMask( tmp )
 
-  print 'A masking workspace has',masking_ws.blocksize(),'spectrum'
-  print 'Unmasked spectrum, value=',masking_ws.readY(0)[0]
-  print 'Masked spectrum,   value=',masking_ws.readY(1)[0]
-  print 'Unmasked spectrum, value=',masking_ws.readY(2)[0]
-  print 'Masked spectrum,   value=',masking_ws.readY(3)[0]
-  print 'Unmasked spectrum, value=',masking_ws.readY(4)[0]
-  print
+  print('A masking workspace has {} spectrum'.format(masking_ws.blocksize()))
+  print('Unmasked spectrum, value = {}'.format(masking_ws.readY(0)[0]))
+  print('Masked spectrum,   value = {}'.format(masking_ws.readY(1)[0]))
+  print('Unmasked spectrum, value = {}'.format(masking_ws.readY(2)[0]))
+  print('Masked spectrum,   value = {}'.format(masking_ws.readY(3)[0]))
+  print('Unmasked spectrum, value = {}'.format(masking_ws.readY(4)[0]))
+  print('')
 
   # Create a data workspace
   ws = CreateSampleWorkspace()
@@ -390,15 +390,15 @@ Example 5: specifying a masking workspace
 
   # Check masking of first 5 detectors
   det = ws.getDetector(0)
-  print 'Detector',det.getID(),'is masked:',det.isMasked()
+  print('Detector {} is masked: {}'.format(det.getID(), det.isMasked()))
   det = ws.getDetector(1)
-  print 'Detector',det.getID(),'is masked:',det.isMasked()
+  print('Detector {} is masked: {}'.format(det.getID(), det.isMasked()))
   det = ws.getDetector(2)
-  print 'Detector',det.getID(),'is masked:',det.isMasked()
+  print('Detector {} is masked: {}'.format(det.getID(), det.isMasked()))
   det = ws.getDetector(3)
-  print 'Detector',det.getID(),'is masked:',det.isMasked()
+  print('Detector {} is masked: {}'.format(det.getID(), det.isMasked()))
   det = ws.getDetector(4)
-  print 'Detector',det.getID(),'is masked:',det.isMasked()
+  print('Detector {} is masked: {}'.format(det.getID(), det.isMasked()))
 
 
 Output
@@ -407,11 +407,11 @@ Output
 .. testoutput:: ExMaskMask
 
   A masking workspace has 1 spectrum
-  Unmasked spectrum, value= 0.0
-  Masked spectrum,   value= 1.0
-  Unmasked spectrum, value= 0.0
-  Masked spectrum,   value= 1.0
-  Unmasked spectrum, value= 0.0
+  Unmasked spectrum, value = 0.0
+  Masked spectrum,   value = 1.0
+  Unmasked spectrum, value = 0.0
+  Masked spectrum,   value = 1.0
+  Unmasked spectrum, value = 0.0
 
   Detector 100 is masked: False
   Detector 101 is masked: True
@@ -430,9 +430,9 @@ Example 6: specifying a masking range
   MaskDetectors(ws, StartWorkspaceIndex=2, EndWorkspaceIndex=4)  
 
   # Check masking of first 6 detectors
-  for ind in xrange(0,6):
+  for ind in range(0,6):
     det = ws.getDetector(ind)
-    print 'Detector',det.getID(),'is masked:',det.isMasked()
+    print('Detector {} is masked: {}'.format(det.getID(), det.isMasked()))
 
 
 Output
@@ -461,13 +461,13 @@ Example 7: constraining the masking range
   # Extract created mask into specialised masking workspace
   masking_ws,_ = ExtractMask( tmp )
 
-  for ind in xrange(0,7):
+  for ind in range(0,7):
     val = masking_ws.readY(ind)[0]
     if val>0:
-        print 'Unmasked spectrum, value=',val    
+        print('Unmasked spectrum, value= {}'.format(val))
     else:
-        print 'Masked spectrum,   value=',val
-  print
+        print('Masked spectrum,   value= {}'.format(val))
+  print('')
 
   # Create a data workspace
   ws = CreateSampleWorkspace()
@@ -475,10 +475,10 @@ Example 7: constraining the masking range
   MaskDetectors(ws, MaskedWorkspace=masking_ws,StartWorkspaceIndex=4, EndWorkspaceIndex=5)
 
   # Check masking of first 7 detectors
-  for ind in xrange(0,7):
+  for ind in range(0,7):
     det = ws.getDetector(ind)
-    print 'Detector',det.getID(),'is masked:',det.isMasked()
-
+    print('Detector {} is masked: {}'.format(det.getID(), det.isMasked()))
+    
 Output
 ^^^^^^
 
diff --git a/docs/source/algorithms/MaskDetectorsInShape-v1.rst b/docs/source/algorithms/MaskDetectorsInShape-v1.rst
index 88c69b4c32ca204cad2f6806f7a557b53b7529c6..109d854381ef70e012b9f698bd7d8081d3a2f907 100644
--- a/docs/source/algorithms/MaskDetectorsInShape-v1.rst
+++ b/docs/source/algorithms/MaskDetectorsInShape-v1.rst
@@ -66,11 +66,11 @@ Usage
       inside_dets.append( det.getID() )
 
   # Print out the IDs
-  print masked_dets
-  print inside_dets
+  print(masked_dets)
+  print(inside_dets)
 
   # Check that the two arrays are equal
-  print masked_dets == inside_dets
+  print(masked_dets == inside_dets)
 
 Output
 ######