In this article, you will learn about how to make basic calculator using Python Programming Language and believe me its very simple and fun.

This basic calculator using Python programming can just perform basic arithmetic functions like addition, subtraction, multiplication, and division.

This simple calculator takes the input from the user and then performs the desired operation on the given input. All this is done in the following steps.

- A user gives the input 2 times with their desire number like 1, 2, 3, and so forth.
- Then if input evaluated/tested with if,…else statements to test the user given input and to decide what to do with this input.
- Then we use functions for all the four operations mentioned earlier.

**See the below example:**

1 2 3 4 5 6 7 8 9 10 11 |
#Below code shows the steps for performing operations # A form of basic calculator Please select what you want to do 1. Addition 2. Subtraction 3. Multiplication 4. Division Please Select from above operations numbers 1, 2, 3, 4: 1 Please enter your first number: 10 Please enter the second number: 23 10 + 23 = 33 |

**See the example code below:**

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# A simple program for making basic calculator # This function use for addition def add(num1, num2): return num1 + num2 # This function use for subtraction def subtract(num1, num2): return num1 - num2 # This function use for multiplication def multiply(num1, num2): return num1 * num2 # This function use for division def divide(num1, num2): return num1 / num2 print("Please select what you want to do -n" "1. Additionn" "2. Subtractionn" "3. Multiplicationn" "4. Divisionn") # This step takes the input from the user select = input("Please choose your desired operation form 1, 2, 3, 4 :") number_1 = int(input("Please enter your first number: ")) number_2 = int(input("Please enter your first number: ")) if select == '1': print(number_1, "+", number_2, "=", add(number_1, number_2)) elif select == '2': print(number_1, "-", number_2, "=", subtract(number_1, number_2)) elif select == '3': print(number_1, "*", number_2, "=", multiply(number_1, number_2)) elif select == '4': print(number_1, "/", number_2, "=", divide(number_1, number_2)) else: print("It is an Invalid input") |

**Code Output:**

1 2 3 4 5 6 7 8 9 10 |
#This is the output of code Please select what you want to do - 1. Addition 2. Subtraction 3. Multiplication 4. Division Please Select from above operations numbers 1, 2, 3, 4: 1 Enter first number : 20 Enter second number : 10 20 + 10 = 30 |

So, this is all of how you can make a basic working calculator using the python programming language.

## James Dextor

12 Nov 2019So simple and easy.

## Jack Sparrow

19 Nov 2019Thank You, Brother.

## Robert Key

19 Nov 2019Will you please elaborate this more for me? I mean a comprehensive calculator with all features.

## Jack Sparrow

19 Nov 2019Thanks for your feedback. Sure I will soon upload a post with your request.