python猜年龄练习
代码:
count
=0
age
=26
while count
<3:
_user_guess
=int(input("userguess:"))
if _user_guess
==age
:
print("congulation")
elif _user_guess
>age
:
print("big")
elif _user_guess
<age
:
print("small")
count
+=1
if count
==3:
choice
=input("继续:Yory")
if choice
=='Y' or choice
=='y':
count
=0
运行截图 在python中,代码的摆放位置也会影响代码的执行结果,所以要理清楚代码的逻辑关系,逻辑一定要严密。
转载请注明原文地址:https://tech.qufami.com/read-27832.html