Python calculator program 🧮

Published: 18 November 2022
on channel: NitCode
7
2

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")


Watch video Python calculator program 🧮 online without registration, duration hours minute second in high quality. This video was added by user NitCode 18 November 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 7 once and liked it 2 people.