标签:pytho nbsp style break 定义 简单 while iot man
简单的while循环:
1 age_konishi = 23 2 3 count = 0 #定义一个计数器 4 while count < 3: #循环小于三次执行下列代码 5 guess_age = int(input("Age: ")) 6 if guess_age == age_konishi: 7 print("Yoshi! Sugoi!") 8 break #猜对时强制跳出 9 elif guess_age > age_konishi: 10 print("You‘re so bad!") 11 else: 12 print("Honey, you‘re so sweetie!") 13 count += 1 14 else: #循环大于三次执行下列代码 15 print("Idiot! I give you too many times!")
标签:pytho nbsp style break 定义 简单 while iot man
原文地址:http://www.cnblogs.com/infinitecodes/p/7214487.html