0

クラスですでに Player を定義していますが、「help」を入力するたびに「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)
4

1 に答える 1

2

あなたが言う時

    input(">> ")

    if input(isValidCMD):
        print("True")

あなたはより多くの入力を求めています。試す:

    cmd = input(">> ")

    if isValidCMD(cmd):
        print("True")

代わりは。

于 2013-10-21T01:31:05.383 に答える