标签:for else
1、打印0-9 十个数字for i in range(10):
print(i)
2、打印偶数:
for i in range(0,10,2):
print(i)
3、if判断中猜游戏,升级(只能猜三次,超过三次没猜对,提示退出)
_age = 18
for i in range(3):
guess_age = int(input("guess_age:"))
if guess_age == _age:
print("GoodLuck!")
break
elif guess_age > _age:
print("cai da le ")
else:
print("cai xiao le ")
else:
print("chao guo san ci qing tui chu!!!")
标签:for else
原文地址:http://blog.51cto.com/limingyu/2097184