我按着小甲鱼的答案写的,但是无法运行?这是什么原因?
import randomtime = 3
secret = random.randint(1,10)
print('------------GAME-----------')
guess = 0
print("请猜一下我心里想的数字:",end="")
while(guess != secret) and (time>0):
temp = input()
guess = int(temp)
time = times - 1
if guess == secret:
print("卧槽,你竟然猜对了!!!")
print("哼,猜对了也是没有奖励哒!!!!")
else:
if guess > secret:
print("哥,大了大了~~~~")
else:
print("嘿嘿,下了小了~~~")
if times > 0:
print("再试一次吧",end="")
else:
print("机会用光了T_T")
print("游戏结束,不玩了")
前面定义的是 time
后面用的是times
BngThea 发表于 2020-3-30 14:39
前面定义的是 time
后面用的是times
感谢感谢!!! time和times混了
time = times - 1
???
页:
[1]