jeudi 1 septembre 2016

While loop wont change variable? (not sure) [duplicate]

This question already has an answer here:

Apologies in advance if there is an answer somewhere i've looked around and cant find exactly what im looking for. Im trying to use a while loop with raw input to cycle if the user inputs help however im also trying to give them additional command options. I am new to this so please excuse my ignorance.

command = raw_input("Type 'Mod', 'Run', 'Exit', or 'Help':")
while command == "Help" or "help" :
    print "Simply enter the command you would like to execute."
    print "Mod: Allows modifications to group values."
    print "Run: Will re-run the program with updated information"
    print "use this command for your updates."
    print "Exit: this will close the program."
    command != "Help" or "help"
    command = raw_input("Type 'Mod', 'Run', 'Exit', or 'Help':")
if command == "Exit" or "exit" :
    exit()
if command == "Mod" or "mod" :
    print "test1"
if command == "Run" or "run" :
    print "test2"

Please advise, Im fairly certain theres something wrong with my multiple instances of "if" because it always prints out whatever the first if is, and im pretty sure my while loop is busted as well.

Aucun commentaire:

Enregistrer un commentaire