我很难让python代码正常工作……我正在制作一个基于故事的游戏,我想检查用户是否输入了正确的类。 我的代码:
ClassPicked = False
#Player Stats
Energy = 1
Health = 1
print("Hello, welcome to this text based game")
while ClassPicked == False:
print("Please choose a class : Warrior or Mage")
classType = input()
#Failsafe to stop non roles to be selected
if classType != "Paladin" "Warrior" or "Mage":
print("You need to select a role")
if classType == "Paladin" "Warrior" or "Mage":
ClassPicked = True
print("You have selected", classType)
我需要帮助,因为while循环不起作用,只需询问用户希望选择什么类,无论输入如何,代码都将继续
or
并不像你想象的那样工作。它只在两个完整表达式之间工作要检查
classType
是否等于您的任何东西,您需要使用不同的策略:相关问题 更多 >
编程相关推荐