mardi 30 octobre 2018

How do I add 'if' commands inside a 'why' loop

So I have some code, like this:

while loopCode == 1:
userCommand = raw_input('Type a command (type \'help\' for syntax): ')

if userCommand == help:
    print 'flight: this command will be used to list a flight'
    print 'restaurant: you will be prompted to type the name of the restaurant, and how much you will spend there'

As you see, there is an if conditional inside the while loop. But when I get prompted to input text, I'm supposed to type 'help' for the conditional to activate. But when I do that, the while loop ignores the conditional. Why is that?

Aucun commentaire:

Enregistrer un commentaire