python 2 流程控制
除了编程语言中常见的while和for循环,python中还有一个独特的while-else循环
#如果带有else,则在while语句正常结束后执行else;如果while被break破坏中止,则不执行else
input_name = input("input your name here: ")
name_list = []
while input_name != 'q':
name_list.append(input_name)
input_name = input("input your name here: ")
else:
print(name_list)
print('Done!')
#容器和迭代器 list set dict tuple str
i = range(0,10,2)
print(list(i))
i = iter("123456")
print(next(i))
print(next(i))