当前位置: 移动技术网 > IT编程>脚本编程>Python > python日记-使用队列写出特殊字数串

python日记-使用队列写出特殊字数串

2018年07月10日  | 移动技术网IT编程  | 我要评论

电视剧怀玉公主,开学第一课节目单,小黑游戏

 1 __author__ = "yang xin"
 2 from sys import stdin
 3 # 给出一串数字,首先将第一个数删除,紧接着把第二个数放在这串数字的最后
 4 # 再将第三个数删除,然后将下一个数放在这串数字的最后,直到把最后一个数
 5 # 删除,然后将删除的数字连接起来输出
 6 
 7 test=[]
 8 
 9 ###################################
10 # 先写一个处理输入数据
11 while True:
12     line=stdin.readline().strip()
13     if line=="":
14         break
15     item=line.split(' ')
16     item=[int(i) for i in item]
17     test=item
18 ###################################
19 head=0;
20 tail=test.__len__()
21 while head<tail:
22     print(test[head])
23     head+=1
24     if head<=tail-1:#防止列表下边溢出报错
25         test.append(test[head]) 
26     # test[tail]=test[head]
27     tail+=1
28     head+=1

 

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网