Simple Errors Code


#1

https://www.codecademy.com/courses/python-beginner-en-cxMGf/0/4?curriculum_id=4f89dab3d788890003000096#

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!


#2

Here:

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

should be:

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

#3

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


#5

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