标签:结束 input trie oop off got loop continue SM
1、for循环竞猜年龄:
age_of_oldboy = 56
#guess_age = int(input("guess age:"))
count = 0
for i in range(3):
guess_age = int(input("guess age:"))
if guess_age == age_of_oldboy :
print("yes, you got it. ")
break #结束循环
elif guess_age > age_of_oldboy:
print("think smaller...")
else:
print("think bigger!")
else:
print("you have tried too many times.. fuck off..")
2、for循环,continue跳出本次循环
for i in range(0,10):
if i < 3:
print("loop",i)
else:
continue #跳出本次循环,进入下次循环
print("hehe...")
标签:结束 input trie oop off got loop continue SM
原文地址:https://www.cnblogs.com/wzsx/p/8932948.html