title: try to find algo on my array
body: <p>I am begginners in python and i want did a program that find the shift in an array : 
  input : [16, 40, 42, 46, 47, 41, 43, 48, 49, 52]
  and i want find the shift of 1, 2 and 3 between the several numbers.
  output : </p>
  
  <pre><code>{0: [46 - 47], 1: [48 - 49]}
  {0: [40 - 42], 1: [41 - 43]}
  {0: [49 - 52]}
  </code></pre>
  
  <p>I have try this :</p>
  
  <pre><code>tab = [16, 40, 42, 46, 47, 41, 43, 48]
  for i, j in enumerate(tab):
      try:
          if tab[i + 1] - tab[i] == 1:
              stock = i
          if tab[i + 1] - tab[i] == 2:
              stock2 = i
      except:
          print ("")
  
  print (tab)
  print ('Shift of one : ' +  '[%d' % tab[stock] + ' - %d]' % tab[stock + 1])
  print ('Shift of two : ' + '[%d' % tab[stock2] + ' - %d]' % tab[stock2 + 1])
  </code></pre>
  
  <p>Tank's you very much !!!</p>