I'm making a simple calculator program in Python, and I'm having trouble understanding why this while loop works only when I am using "and" when checking if the variable is a valid operator. logically, I would expect it to check if the input is "+" OR "-", etc.
Here is the loop:
operator = input("Enter operator: ")
while operator != "+" and operator != "-" and operator != "*" and operator != "/":
operator = input("Enter a valid operator: ")
I'm especially confused, because it seems to be working as expected in this other loop:
while num1 == "0" or num1.isdigit() == False:
print("You must enter a valid number that is not 0!")
num1 = input("Enter first number: ")