Skip to content

Commit

Permalink
Merge pull request #29 from shubhankar-shandilya-india/Python-Project
Browse files Browse the repository at this point in the history
Calculator by Python #3
  • Loading branch information
kishanrajput23 authored Oct 1, 2022
2 parents 34957c2 + 289ba63 commit 2cb1ca0
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
31 changes: 31 additions & 0 deletions Calculator/Calculator.py
Original file line number Diff line number Diff line change
@@ -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")
13 changes: 13 additions & 0 deletions Calculator/ReadMe.md
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 2cb1ca0

Please sign in to comment.