循环报数
from itertools import cycle
def demo(lst,k):
t_lst=lst[:]
while len(t_lst)>1:
c=cycle(t_lst)
print©
for i in range(k):
t=next©
print(t)
index=t_lst.index(t)
t_lst=t_lst[index+1:]+t_lst[:index]
return t_lst[0]
lst=list(range(1,11))
print(demo(lst,3))
2021-06-23
最新推荐文章于 2021-09-14 12:37:41 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)