CalculatorProgram

.py
School
North South University**We aren't endorsed by this school
Course
CSE 115
Subject
Computer Science
Date
Dec 22, 2024
Pages
1
Uploaded by GeneralSalmon4820
# Python Calculatoroperator = input("Enter an operator (+ - * /): ")num1 = float(input("Enter the 1st number: "))num2 = float(input("Enter the 2nd number: "))if operator == "+":result = num1 + num2print(round(result, 3))elif operator == "-":result = num1 - num2print(round(result, 3))elif operator == "*":result = num1 * num2print(round(result, 3))elif operator == "/":result = num1 / num2print(round(result, 3))else:print(f"{operator} is not a valid operator!")
Background image