operator = input("Enter an operator (+ - * /): ")
num1 = float(input("Enter the 1st number: "))
num2 = float(input("Enter the 2nd number: "))
if operator == "+":
result = num1 + num2
print(round(result, 3))
elif operator == "-":
result = num1 - num2
print(round(result, 3))
elif operator == "*":
result = num1 * num2
print(round(result, 3))
elif operator == "/":
result = num1 / num2
print(round(result, 3))
else:
print(f"{operator} is not a valid operator")
On this page of the site you can watch the video online Python calculator program 🧮 with a duration of hours minute second in good quality, which was uploaded by the user NitCode 18 November 2022, share the link with friends and acquaintances, this video has already been watched 7 times on youtube and it was liked by 2 viewers. Enjoy your viewing!