import random
times = 3
x = random.randint(1,10)
print('---------猜数字小游戏---------')
temp = input('猜猜看现在是1-10之间的什么数字:')
guess = int(temp)
while guess != x and times > 0:
if guess > 10 or guess < 0 :
print('请输入规格内的数字。')
temp = input('请继续输入吧:')
guess = int(temp)
else:
times -= 1
if times == 0 and guess != x:
print('哎呀,还是错了!正确答案是:',x,'你的次数用完咯。')
break
if guess > x :
print('呀,大啦!')
print('再想一下吧')
temp = input('请继续输入吧:')
guess = int(temp)
else:
print('嘿,小啦!')
print('真笨!')
temp = input('请重新输入吧:')
guess = int(temp)
if guess == x:
print('恭喜你!答对啦~~')
print ('好啦,不玩啦!')