op = {}
while op != "+" or "-" or "x" or "/":
op = str(input("Type in an expression: "))
print("Invalid")
Output
Type in an expression: +
Invalid
Type in an expression: -
Invalid
Type in an expression: /
Invalid
Type in an expression: x
Invalid
Type in an expression:
// this bit is the return i get when running the code
This is a simple calculator that allows the user to choose an operator type based on input. I've added the bit of code, and what it returns when I run it. No error messages at all. Any help to get this to work will be greatly appreciated. Also, tell me of any better ways I can improve this piece of code. Thanks so much!