I just started with python, I tried to make 2 loops: first loop to be sure that the client enter the right entry; the other loop to resolve the calculation variables. But all the time I get "Unknown Entry"
OperationSelected = False
UnKnownEntry = False
while OperationSelected == False or UnKnownEntry == True:
try:
operation = input("Select operation to perform:\r\n1>PLUS\r\n2>MINU\r\n3>MULTIP\r\n4>DIVIDE\r\n>>> ")
if operation != "1" or operation != "2" or operation != "3" or operation != "4":
print("--------------------------")
print("Unknown entry. ( " + operation + " )")
print("--------------------------")
UnKnownEntry == True
else:
print("TEST")
OperationSelected = True
UnKnownEntry = False
except Exception as e:
print(e)
break
while OperationSelected == True and UnKnownEntry == False:
try:
num1 = input("Enter first number: ")
num2 = input("Enter second number: ")
if operation == "1":
print("--------------------------------------")
print("The Sulotion is: " + str(float(num1) + float(num2)))
print("--------------------------------------")
elif operation == "2":
print("--------------------------------------")
print("The Sulotion is: " + str(float(num1) - float(num2)))
print("--------------------------------------")
elif operation == "3":
print("--------------------------------------")
print("The Sulotion is: " + str(float(num1) * float(num2)))
print("--------------------------------------")
elif operation == "4":
print("--------------------------------------")
print("The Sulotion is: " + str(float(num1) / float(num2)))
print("--------------------------------------")
except Exception as e:
print(e)
break