Let's code a simple python calculator! 🧮

Published: 13 August 2024
on channel: Bro Code
84,395
1.3k

#python #pythontutorial #pythoncourse

Python calculator
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 Let's code a simple python calculator! 🧮 with a duration of hours minute second in good quality, which was uploaded by the user Bro Code 13 August 2024, share the link with friends and acquaintances, this video has already been watched 84,395 times on youtube and it was liked by 1.3 thousand viewers. Enjoy your viewing!