为什么在我没有跑步的情况下开采? (Python 3.x)

时间:2017-09-28 20:54:25

标签: python-3.x while-loop

我正在制作一个非常简单的滚动骰子模拟器游戏,但是while块没有运行,不知道为什么!

if data == 'roll the dice':
    print("You've got", str(rn) + "!")

    while repeat == False:
        rn2 = random.randint(1,6)
        data2 = input('Do you want to roll again? (Y/N): ').lower()

        if data2 == 'y':
            print("You've got", rn2, "this time!")
            repeat=True
        if data2 == 'n':
            print('Thanks for playing!')
            repeat=False

2 个答案:

答案 0 :(得分:0)

repeat的值初始化为False

答案 1 :(得分:0)

你没有初始化重复吗?这甚至不会运行一次

相关问题