
from random import*
y = randint(0, 100)
n=0
while 1:
    n=n+1
    try:
        s = int(input("输入所猜的数: "))
        if s>y:
            print("猜大了!")
        elif s<y:
            print("猜小了!")
        else:
            print("猜对了!")
            break
    except:
        print("请输入整数")
print("猜了{}次".format(n))


