Why 'and' and not 'or'


#1

https://www.codecademy.com/courses/learn-python/lessons/loops/exercises/simple-errors?action=lesson_resume

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: ")

#2

Because OR short-circuits on True.


#3

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