vendredi 28 avril 2017

Can someone explain why elif is being ignored?

I'm very new to programming can't wrap my head around why my elif statements are being ignored. Can anyone help?

prompt = ("Enter your age to buy a ticket ")
prompt += ("or type 'quit' to end the program:")

while True:
    age = raw_input(prompt)

    if age == 'quit':
        break
    elif age < 3:
        print "Free ticket."
    elif age < 12:
        print "$10 ticket."
    else:
        print"$15 ticket."

Aucun commentaire:

Enregistrer un commentaire