samedi 30 janvier 2021

Python: if not true function is not running as it should [duplicate]

If the user doesn't type in multiplication, addition, ect, then a string should be printed. However, if one of these words is typed it still prints this string. I've just started with python; sorry that it's such a basic question!

print ("Multiplication, Addition, Subtraction or Division?")
type = str(input("Your choice:"))
if type != "multiplication" or "addition" or "subtraction" or "division":
    print("YOU DID NOT ENTER ONE OF THE ABOVE OPTIONS.\nTRY AGAIN!")
num1 = int(input("Enter your 1st number:"))

Aucun commentaire:

Enregistrer un commentaire