|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
大佬们好!
请大佬们看看我这串代码出现了什么问题?
为什么停不下来?
import random
times = 3
secret=random.randint(1,10)
print("Let's get start")
temp=input("Let's guess what i'm thinking right now:")
guess=int(temp)
while guess !=secret:
if guess >secret:
print("Smaller than it")
else:
if guess ==secret:
print("Ahh, cool, that's good")
else:
print("Bigger than it")
print("that's all, you won't have more chance")
- import random
- times = 3
- secret=random.randint(1,10)
- print("Let's get start")
- temp=input("Let's guess what i'm thinking right now:")
- guess=int(temp)
- if guess == secret:
- print('Congratulations')
- else:
- while guess !=secret and times>0:
- temp=input("Trt again:")
- guess=int(temp)
- times -= 1
- if guess >secret:
- print("Smaller than it")
- else:
- if guess ==secret:
- print("Ahh, cool, that's good")
- else:
- print("Bigger than it")
- print("that's all, you won't have more chance")
复制代码
|
|