import random
num = random.randint(1, 100)
times = 0
while times < 5:
guessnum = int(input("请输入你猜的数:"))
if guessnum == num:
print("恭喜你猜对了!" + "这个数是:" + num)
break
elif guessnum < num:
print("很遗憾,你猜小了,继续加油吧")
elif guessnum > num:
print("很遗憾,你猜大了,继续加油吧")
times += 1
print("你已经用完5次机会了")
import random
secret = random.randint(1,10)
print('-------------猜字游戏-------------')
temp= input('猜一猜是那个数字')
guess = int(temp)
while guess != secret:
temp = input('猜错了,再猜一次')
guess = int(temp)
if guess == secret:
print('猜对了好厉害')
print('奖励你一个糖果')
else:
if guess>secret:
print('猜大了哦')
else:
if guess<secret:
print('猜小了哦')
print('游戏结束,不玩了')