I'm a python beginner and i'm trying to make a calculator that instead of asking the user enter first number than an operator and than antoher number to return the result, the user can be able to input like for example 3 * 3 in one single input so the computer returns 9.
num1 = float(input("Enter a number: "))
op = input("Enter an operator: ")
num2 = float(input("Enter another number: "))
if op == "+":
print(num1 + num2)
elif op == "-":
print(num1 - num2)
elif op == "*":
print(num1 * num2)
elif op == "/":
print(num1 / num2)
else:
print(" Enter a valid operator...")