0
点赞
收藏
分享

微信扫一扫

用Python写了个数字炸弹的小游戏

山竹山竹px 2022-03-23 阅读 72
python
import random
num = random.randint(1,100)
n = 1
m = 100
while True:
    x = input("输入一个数字\nEnter a number:")
    y = int(x)

    if y == num:
        print("炸弹来咯~\nThe bomb to cough up")
        print("乖乖接受惩罚吧\nJust accept your punishment")
        break

    else:
        #print(num)
        if y < num:
            if n < y:
                print('%d~%d'%(y,m))
                n = y
            else:
                print('不可以这样哦,请重新说一个数字\nYou cant do that,Please re-enter')
        else:
            if y < m:
                print('%d~%d'%(n,y))
                m = y
            else:
                print('不可以这样哦,请重新说一个数字\nYou cant do that,Please re-enter')

        #print(n)
        #print(m)
举报

相关推荐

0 条评论