python 小甲鱼猜数字游戏

1、

#guess integer game

import random
secret = random.randint(1,10)
temp = input("please input an integer:")
guess = int(temp)
times = 1

while (guess != secret) and (times < 3):
    if guess > secret:
        print("big,big")
    else:
        print("small,small")

    temp = input("please try again:")
    guess = int(temp)
    times += 1

if (guess == secret) and (times <= 3):
    print("you are right.")
else:
    print("three times chance over, game over!")
原文地址:https://www.cnblogs.com/liujiaxin2018/p/14382867.html