2 Answers
+ 1
from collections import deque
mydeque = deque([1, 2, 3, 4])
for x in range(0, len(mydeque)):
print(list(mydeque))
mydeque.rotate(-1)
# or use
mylist = [1, 2, 3, 4]
for x in range(len(mylist)):
print(mylist)
mylist.append(mylist.pop(0))
0
Use deque from collection module and implement it's 'rotate' method.
I'l give you a few minuets for you to have a go...just please... try something yourself first.