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