马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
帮忙找下问题,为什么只输入了一次就结束了import random
times = 3
no = random.randint(1,100)
name = input("请输入您的姓名:")
print('你好,' + name + '!''开始答题')
temp = input("1+1:")
guess = int(temp)
while guess != 2:
if guess < 2:
print('小了')
if guess > 2:
print("大了")
temp = input("新的填入:")
guess = int(temp)
print("通知:正确")
temp = input("有时候运气也是实力的一种,猜1~100的数:")
yet = int(temp)
while (yet != no) and (times > 0):
if yet < no:
print('小了')
if yet > no:
print("大了")
if times > 0:
print("再试一次吧:", end=" ")
else:
print("机会用光咯T_T")
temp = input("新的填入:")
yet = int(temp)
times = times - 1 # 用户每输入一次,可用机会就-1
print("通知:正确")
|