python学习第二天-随机数猜数练习

import random
num = random.randint(0,10)
while 1:
    num_gus = int(input('guess one num :'))
    if num_gus > num:
        print('a little big')
    elif num_gus < num:
        print('a little little')
    else:
        print('U are right!!!')
        break
import random
age = random.randint(1,100)
print(age)
num = 0
while num <= 3:
    num += 1
    age_gus = int(input('age:'))
    if age_gus == age:
        break
    elif age_gus != age and num < 3:
        print('error,gues again!')
    elif age_gus != age and num == 3:
        manager = input('Game Over!Replay : Yes(Y) or No(N)?').upper()
        if manager == 'Y':
            num = 0
        else:
            break
原文地址:https://www.cnblogs.com/thanos-ryan/p/13246247.html