猫史档案馆


Python 猜数字小游戏 【如有bug,请多多指教】

用户:追星人追星人查看:0 回复:0 评论:0 创建时间:2019-08-16T19:59:15


import random
w = ('\n')
b = 1
c = 1
while True :
    m = int(input('wellome to the NEXT NUMBER game , what level are you ? [ 1.hard / 2.mean / 3.easy ](enter number)\n'))
    if m == 1:
        a = random.randrange(40, 90)
        print("Guess a number, I'll give you some clue about it.")
        print('It is beween 40 ~ 90')
        print('(have 40 and 90 )' )
    elif m == 2:
        a = random.randrange(10, 30)
        print("Guess a number, I'll give you some clue about it.")
        print('It is beween 10 ~ 30')
        print('(have 10 and 30 )' )
    if m == 3:
        a = random.randrange(1, 9)
        print("Guess a number, I'll give you some clue about it.")
        print('It is beween 1 ~ 9 ')
        print('(have 1 and 9 )')
    for x in range (3):
         e = int(input ("I'll give you three trys ,after it I'll tell you if you are right:\n"))
        if e > a:
            print('the number is biger than it!')
            elif e < a:
            print('number is 喵aller than it!')
        if e == a:
            print('you are right!The anwser is ' + str(a))
            break

    print("don't worry,try it next time")
    print('the anwer is :' + str(a))


回复

上一页1 页 / 共 0下一页