1

I am having an issue with this while loop. No matter what I type it still loops. Any help would be greatly appreciated.

inputCorrect = False
while inputCorrect == False:
    print("Do you want to Add, Subtract, Divide, Multiply or General Calculator")
    option = input(">> ")
    option = option.lower()
    if option == ("multiply" or "general calculator" or "add" or "subtract" or "divide"):
        inputCorrect = True
Nick Bondarenko
  • 6,211
  • 4
  • 35
  • 56

1 Answers1

2

The if statement can be either

if option in ("multiply", "general calculator", "add", "subtract", "divide")

or

if option == "multiply" or option == "general calculator" or ...

I think your if statement is an equivalent to option == True in Python, as ("multiply" or "general calculator" or "add" or "subtract" or "divide") is evaluated to True. And 'option' is a String, it never be True.

Andrew Liu
  • 351
  • 1
  • 9