python 随机猜数小游戏

import random
secret = random.randint(1 , 10)
while 1==1 :
    temp = input("请输入一个数字:")
    guess =  int(temp)
    if guess == secret:
        print("恭喜答对了")
        break
    else :
        if guess > secret:
            print("数值大了,大了")
        else:
            print("数值小了,小了")
print("end")

你可能感兴趣的:(python)