[Tutor] Else and If

Mimi Ou Yang mimiouyang at hotmail.com
Tue Sep 9 02:48:18 CEST 2014


print ("Quiz TIME!!!")


ready = input("Are you ready?")


if (ready in ("yes","YES","Yes")):
    print ("Alrighty")


if (ready in ("no","NO","No")):
    print ("Too bad so sad. You're obligated to do it.")


else:
    print ("OK (sarcasm)")


q1 = input("1. When was Quebec City founded? a. 1608 b. 1690 c. 1900:  ")


if (q1 == "a"):
    print ("Good answer.On to the next question.")


q2 = input("2. What is 1+1?  a. 5  b.8  c.2:  ")


if (q2 == "c"):
    print ("Hooray Good answer")


else:
    print ("Wrong Answer")


q3 = input("What color was Napoleon's white horse? a. black b. white c.brown:  ")


if (q3 in ("b","B")):
    print ("Good.Next question.")


else:
    print ("Wrong.Next question.")




When I write yes or YES or Yes or no or No or NO in the ready input it always print out Alrighty and OK (sarcasm) can you tell me what is the mistake in my code?


     Thanks​
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140909/ae5ae072/attachment.html>


More information about the Tutor mailing list