小编use*_*690的帖子

如何在Python中使用sys.exit()

player_input = '' # This has to be initialized for the loop

while player_input != 0:

    player_input = str(input('Roll or quit (r or q)'))

    if player_input == q: # This will break the loop if the player decides to quit

        print("Now let's see if I can beat your score of", player)
        break

    if player_input != r:

        print('invalid choice, try again')

    if player_input ==r:

        roll= randint (1,8)

        player +=roll #(+= sign helps to keep track of score)

        print('You rolled is ' …
Run Code Online (Sandbox Code Playgroud)

python exit python-3.x

16
推荐指数
3
解决办法
13万
查看次数

标签 统计

exit ×1

python ×1

python-3.x ×1