From 43ce9a26594b94699c53bee9c27e73d103692c01 Mon Sep 17 00:00:00 2001 From: Oashe02 Date: Thu, 24 Oct 2024 22:48:15 +0530 Subject: [PATCH] Create Simple Command-Line Calculator This code helps to solve Simple Command-Line Calculations... --- Simple Command-Line Calculator | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Simple Command-Line Calculator diff --git a/Simple Command-Line Calculator b/Simple Command-Line Calculator new file mode 100644 index 0000000..8f4268b --- /dev/null +++ b/Simple Command-Line Calculator @@ -0,0 +1,17 @@ +def calculator(): + operation = input("Choose operation (+, -, *, /): ") + num1 = float(input("Enter first number: ")) + num2 = float(input("Enter second number: ")) + + if operation == '+': + print(num1 + num2) + elif operation == '-': + print(num1 - num2) + elif operation == '*': + print(num1 * num2) + elif operation == '/': + print(num1 / num2) + else: + print("Invalid operation") + +calculator()