本次学习内容
1.for循环
2.continue and break
3.while循环
4.运算符
5.数据类型
数字
字符串
列表
1.for循环
猜年龄的游戏完善下,只有三次机会
for i in range(3)#循环3次
for...else#如果for循环正常结束,就执行else下面的语句
exit()#退出程序
hongpeng_age = 21 for i in range(3): age = int(input("please guess age:"))#int 输入字符串转换成整型 if age == hongpeng_age: print('get it') break elif age < hongpeng_age: print ('try bigger') else: print('try smaller') else: exit("too much times") print('welcome...')