From 07937c53ba9ce195b983efd5861d472ea6c9a9c7 Mon Sep 17 00:00:00 2001 From: moumita podder <75267902+moumitapodder@users.noreply.github.com> Date: Wed, 19 Oct 2022 12:39:52 +0530 Subject: [PATCH] Create calculator.py --- Python/calculator.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Python/calculator.py diff --git a/Python/calculator.py b/Python/calculator.py new file mode 100644 index 0000000..c030ff1 --- /dev/null +++ b/Python/calculator.py @@ -0,0 +1,24 @@ +print ("~~~~~Mini Calculator~~~~~") + +num1 = float(input("Enter a number here: ")) +num2 = float(input("Enter another number here: ")) + +print (""" +Press 1 for addition +Press 2 for subtraction +Press 3 for multiplication +Press 4 for division""") + +choice = int(input("enter a number between 1-4: ")) + +if choice == 1: + sum = num1+num2 + print ("the addition of the given two numbers is",sum) +elif choice == 2: + print ("The subtraction of the given two numbers is",num1-num2) +elif choice == 3: + print ("The multiplication of the given two numbers is",num1*num2) +elif choice == 4: + print ("The division of the given two numbers is",num1/num2) +else: + print ("Invalid Input from the User")