Why if i use OR at !!! section, does it break even if i type a number 1 - 9 in the guess input. And why do i not need to type BOTH 'q' and 'quit', because thats what i assume AND means... 'q' AND 'quit'...
import random
while True:
print("\nGuess a number between 1 and 9.")
guess = input("I guess: ")
if guess == 'q' !!!or!!! 'quit':
break
number = random.randrange(1, 10)
try:
if int(guess) < number:
print(f"You guess was too low. The number was {number}")
elif int(guess) > number:
print(f"Your guess was too high. The number was {number}")
elif int(guess) == number:
print(f"Your guess was exactly right! The number was {number}")
except ValueError:
print("Please only guess numbers!")
So with OR it doesn't work and with AND it does. This makes no sense to me. Why is this?