import random
min = 1
max = 100
number = random.randint(min, max)
print(number)
count = 0
while count < 10:
guess = eval(input("Please enter a number between {} and {}:".format(min, max)))
if guess > max:
count = count + 1
continue
elif guess < min:
count = count + 1
continue
if guess == number:
print("猜中了")
break
elif guess > number:
print("猜大了")
max = guess - 1
count = count + 1
continue
elif guess < number:
print("猜小了")
min = guess + 1
count = count + 1
continue
if count == 10:
print("游戏失败")
暂无评论