How would I write the definition for this def shift(my_list): "Shifts the list [x1,x2,...,xn] to [x2,x3,...,xn,x1]."

Hey! We 've verified this expert answer for you, click below to unlock the details :)

I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!

If you don't get what i am trying to do, i am defining a function that will shift the list to the right moving the first element to the end.

You can try this - it may not be pretty, but it works. I threw in print statements so you could see whats happening. def shifting(): a = [1,2,3,4] for i in range(5): print "Original List:", a b = a[1:] b.append(a[0]) print "Ammended List:", b print a = b

You could do it just once, or as many times as you wish, by changing the range(x).

Looking for something else?

Not the answer you are looking for? Search for more explanations.

## More answers

Looking for something else?

Not the answer you are looking for? Search for more explanations.