Simple Errors Code


My code has some sort of error, stating this every time I type in y or n for my input:

Oops, try again. Does your code accept anything other than "y" and "n"?

The code should work fine... I even try an input other than y or n and it works, but if I type in either of those two letters as the next input it shows this error.

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

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

Please Help!



while choice != 'y' and 'n':

should be:

while choice != 'y' and choice != 'n':


Oh okay, didn't know that you can't use conditions the way I used it. Thanks!


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