1.向后传递 [2,3,4,5,6,1]
import time
lst=[1,2,3,4,5,6]
while True:
t=lst[0] #1
i=0
while i<len(lst)-1: #循环5次
lst[i]=lst[i+1]
i+=1
lst[len(lst)-1]=t
print(lst)
time.sleep(1)
2.向前传递 [6,1,2,3,4,5]
lst=[1,2,3,4,5,6]
while True:
t=lst[len(lst)-1] #6 将6掏空
i=len(lst)-1 #5
while i>0:
lst[i]=lst[i-1]
i-=1 #4
lst[0]=t #6
print(lst)