title: Shifting the elements of an array in python
body: <p>I am trying to shift the elements of an array cyclically so all elements are replaced with the previous element, and the last rotates to the first poaition, like so: shift(1, [5, 6, 7])=&gt;[7, 5, 6].</p>
  <p>The following code only returns [7,5]. Could someone please tell me what is causing this to happen? I went through the code step by step and simply could not find a solution. I also tried 3 different interpreters.</p>
  <pre><code>def shift(key, array):
      counter = range(len(array)-1)
      new = counter
      for i in counter:
          new[i] = array[i-key]
      return new
  
  print shift(1, [5, 6, 7])
  </code></pre>