逐级嵌套思想
import random
num=random.randint(1,10)
print(num)
guess=int(input("请输入第一次:"))
if guess==num:
print("猜中了")
else:
if guess>num:
print("猜大了")
else:
print("猜小了")
guess = int(input("请再输入第一次:"))
if guess == num:
print("猜中了")
else:
if guess > num:
print("猜大了")
else:
print("猜小了")
guess = int(input("请最后再输入第一次:"))
if guess == num:
print("猜中了")
else:
if guess > num:
print("猜大了")
else:
print("猜小了")