I am confused about the logic to this question, below is my code which is correct and i understand why it is correct, but my question is why the other answers i tried give me an infinite loop.
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: ") #other answers #while (choice != 'y' or choice != 'n') #while (choice != 'y' or 'n')
Again I understand the logic on the correct answer, but if you enter 'y' or 'n' on the other two answers you get an infinite loop, if you're supposed to check whether the answer is 'y' OR 'n' and the choice is infact 'y' or 'n' why does the loop still run infinitely?