Simple Errors Question


It keeps on repeating the the question with this code, and I know I’m supposed to use and. My only question is, why can I use and but not or?

choice = raw_input('Enjoying the course? (y/n)')

while choice != 'y' and choice != 'n':  # Fill in the condition (before the colon)
    choice = raw_input("Sorry, I didn't catch that. Enter again: ")


When we use and both operands have to yield True. When we use or only one has to be True.


If you enter y the !='n' operand is true, and if you enter n the !='y' operand is true.

or is not the logic to use in the above expression.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.