我已经在一个类中定义了 Player,但是为什么我在输入“帮助”时无法让它打印“true”?我没有收到任何错误,但它只是继续 While 循环。我只是没有看到什么吗?
Commands = { #In-game commands
'help': help,
'exit': exit
}
def charactercreation():
print("Welcome to the wasteland. What is your name? ")
Player.name = input(">> ")
Player.hp = 30
Player.curhp = 30
Player.per = 7
Player.dr = 1
Player.agi = 5
def isValidCMD(cmd):
if cmd in Commands:
return True
return False
def main(Player): #Main function
Player.dead = False
while(Player.dead == False):
input(">> ")
if input(isValidCMD):
print("True")
charactercreation()
main(Player)