From 7aa5089ee69eb0bdab37fc42d7fd39195cd6f62c Mon Sep 17 00:00:00 2001 From: Shubhankar Shandilya <78155393+shubhankar-shandilya-india@users.noreply.github.com> Date: Sat, 1 Oct 2022 15:14:34 +0530 Subject: [PATCH 1/2] Created a Calculator using python #3 --- Calculator/Calculator.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Calculator/Calculator.py diff --git a/Calculator/Calculator.py b/Calculator/Calculator.py new file mode 100644 index 0000000..fb5a646 --- /dev/null +++ b/Calculator/Calculator.py @@ -0,0 +1,31 @@ +# This function performs additiion +def add(a, b): + return a + b +# This function performs subtraction +def subtract(a, b): + return a - b +# This function performs multiplication +def multiply(a, b): + return a * b +# This function performs division +def divide(a, b): +return a / b +print("Select an operation.") +print("+") +print("-") +print("*") +print("/") +# User input +choice = input("Enter operator to use:") +A = int(input("Enter first number: ")) +B = int(input("Enter second number: ")) +if choice == '+': + print(A,"+",B,"=", add(A,B)) +elif choice == '-': + print(A,"-",B,"=", subtract(A,B)) +elif choice == '*': + print(A,"*",B,"=", multiply(A,B)) +elif choice == '/': + print(A,"/",B,"=", divide(A,B)) +else: +print("Invalid input") From 289ba631e251bb05783ed5cd2f839a7967539363 Mon Sep 17 00:00:00 2001 From: Shubhankar Shandilya <78155393+shubhankar-shandilya-india@users.noreply.github.com> Date: Sat, 1 Oct 2022 15:24:45 +0530 Subject: [PATCH 2/2] ReadMe file for Python calculator #3 --- Calculator/ReadMe.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Calculator/ReadMe.md diff --git a/Calculator/ReadMe.md b/Calculator/ReadMe.md new file mode 100644 index 0000000..63fdfda --- /dev/null +++ b/Calculator/ReadMe.md @@ -0,0 +1,13 @@ +# Basic Calculator + +## I Have made this Calculator by Python + +### First of all i take the input of operator (+,-,*,/) + +### Then we take inout of bot operand + +### Then the value goes to function as per the operand entered + + ![Screenshot (45)](https://user-images.githubusercontent.com/78155393/193403781-2ca655e7-1ddf-4e9e-ad0c-e344fd4899dd.png) + +## Hence the result is printed