n =5for i inrange(2,n):print(i,end =" ")print('\n')for i inrange(n):print(i,end =" ")#output
runfile('C:/Users/Administrator/Desktop/python_text/4_5.py', wdir='C:/Users/Administrator/Desktop/python_text')23401234#总结:最后一个n是不输出来的,python 从0开始
#把列表当成队列来使用>>>from collections import deque
>>> queue = deque(["Eric","John","Michael"])>>> queue.append("Terry")# Terry arrives>>> queue.append("Graham")# Graham arrives>>> queue.popleft()# The first to arrive now leaves'Eric'>>> queue.popleft()# The second to arrive now leaves'John'>>> queue # Remaining queue in order of arrival
deque(['Michael','Terry','Graham'])