Classes/Spring 2025/ENGR 490/4/P4/Scripts/simple_calculator.py

18 lines
440 B
Python

num1 = float(input("Enter the first number: "))
num2 = float(input("Enter the second number: "))
operation = input("CHoose an operation (+, -, *, /): ")
if operation == "+":
result = num1 + num2
elif operation == "-":
result = num1 - num2
elif operation == "*":
result = num1 * num2
elif operation == "/":
result = num1 / num2
else:
result = "Invalid operation"
print(f"Result: {num1} {operation} {num2} = {result}")