2019-07-29day6作业

随机数游戏

import random

while True:
    x = random.randint(1, 100)
    n = int(input('Please inout the num(1~100): '))
    time = 1
    while time != 8:
        if n == x:
            print('Congratulations!')
            break
        else:
            if x > n:
                n = int(input('Bigger than it: '))
                if time == 4 or time == 5:
                    print('Come on man, you can make it!')
                elif time == 6:
                    print('Alright, give up!')
            elif x < n:
                n = int(input("Smaller than it: "))
                if time == 4 or time == 5:
                    print('Come on man, you can make it!')
                elif time == 6:
                    print('Alright, give up!')
            time += 1
    if time == 8:
        print('hahahahahahahaha_(:з」∠)_\n'+'You play a egg, ばか!')

    input()
    choice = input("You wanna try again?"+'\n'+'1: Try again     2: Give up'+'\n'+':')
    if choice == '1':
        pass
    elif choice == '2':
        print('Good luck!')
        break

你可能感兴趣的:(2019-07-29day6作业)