【发布时间】:2020-11-19 04:32:23
【问题描述】:
import random
import sys
player_oneN = input("Enter Name for Player One")
player_twoN = input("Enter Name for Player Two")
player_oneS = 0
player_twoS = 0
if player_oneN == "stop" or "exit":
c = int(input("Press 1 to continue and 0 to quit :"))
if c == 0:
sys.exit()
if player_twoN == "stop" or "exit":
c = int(input("Press 1 to continue and 0 to quit :"))
if c == 0:
sys.exit()
每当我尝试运行此代码时,总是会显示退出程序的选项。我只希望当用户在玩家一和玩家二输入中进入退出或停止时此选项可用。
【问题讨论】:
-
请提供有关此代码上下文的更多信息。
-
这能回答你的问题吗? or condition in while loop python
-
试试
if player_oneN in ["stop", "exit"]:
标签: python-3.x