_pwd = 123
count = 0
while count < 3:
pwd = int(input("pwd:"))
if _pwd == pwd:
print("密码输入正确")
break
elif _pwd > pwd:
print("猜的太小了")
else:
print("猜的太大了")
count += 1
else:
print("游戏结束")
for循环
for i in range(3):
pwd = int(input("pwd:"))
if _pwd == pwd:
print("密码输入正确")
break
elif _pwd > pwd:
print("猜的太小了")
else:
print("猜的太大了")
count += 1
else:
print("游戏结束")
for i in range(20, 30, 2):
print(i)
for i in "123":
print(i)
continue 结束本次循环
break 结束整个循环