Simple Errors(don't understand while)


#1

I keep getting this error message Oops, try again. You should only accept "y" and "n" as choices and keep asking until the response is "y" or "n" for this set of code

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

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

what should I be doing to make this right? the hint isn't really helping


#2

you need to do comparison at both sides of the of the and operator, example:

if 1 == True and 0 == False:

#3

how would I do that in this situation though?


#4

so far I have this:

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

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

#5

the True and False where just to demonstrate how to do comparison at both sides of the and operator

in your case it would simply be:

while choice != "y" and choice != "n"

#6

thank you! that fixed it


#7