Why 'and' and not 'or'



This sounds like a silly question, but why is it ‘and’ and not ‘or’ ?

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

while choice != 'y' and choice != 'n': 
  choice = raw_input("Sorry, I didn't catch that. Enter again: ")


Because OR short-circuits on True.


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