Why is the while loop not ending

Question:

holes = int(input("Enter number of holes"))  
if holes == 18 or holes == 9:     
  print(holes, "holes")
else:    
  while holes != 18 or holes != 9:         
    holes = int(input("18 or 9 holes only."))
Asked By: newbee

||

Answers:

Because if it holes is 18, then it isn’t 9, and the other way around. What you mean is

while not (holes == 18 or holes == 9):

Answered By: kutschkem
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.