猜数字改进
while True:import random
secret = random.randint(1,10)
time = 3
temp = int(input('请输入数字:'))
while temp!= secret:
temp = int(input('猜错了,请重新输入数字:'))
if temp == secret:
print('猜中了')
print('厉害')
else:
print('猜错了')
time -= 1
if time ==0:
print('机会用光了,')
break
页:
[1]