title: python move all elements of a list to the right by one
body: <p>So I want to move all the elements to the right so for example if I had a list of <code>[1, 2, 3, 4, 5]</code> it would become <code>[5, 1, 2, 3, 4]</code>. So basically the rightmost element wraps around to the leftmost element and the other elements basically shift the right.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>length = len(values)
  old_right = values[length - 1]
  for j in range(length - 1, 0, -1):
      values[j] = values[j - 1]
  values[0] = old_right
  </code></pre>
  
  <p>When i enter it in idle i get an error on the last line on values[0] (highlighted on values) saying <code>SyntaxError: invalid syntax</code>. I do not know why I get this error.</p>
  
  <p>Also, how would I have to change my code to make it go from <code>[5, 4, 3, 2, 1]</code> back to <code>[1, 2, 3, 4, 5]</code>, i.e. reverse the process?</p>