Adding, Subtracting, Multiplication & Division of two numbers in Python

One of the greatest things about python language is its simplicity, consider adding two numbers in any other language you need to define variables, assign values etc., but python simplifies everything.

Open python shell , click File and select New File
and in a new file type the following code.


n1 = input("Enter number 1 : ")
n2 = input("Enter number 2 : ")
n3 = n1 + n2
print("The sum is ",n3)


Click "Run" and select "Run Module" or if you are a pro just hit "F5"
The output will be somewhat like this
>>>
Enter number 1 : 6
Enter number 2 : 6
The sum is  66

And what went wrong???  instead of adding two numbers its just concatenated!
 that's because python takes every value as "A STRING",
so we need to change the string to integer, how can this be done????
Simple, we convert string value using "int( )"

Open the python file and modify the following 

n3 = int(n1) + int(n2)

Save the file using "Ctrl + S"
Hit "F5"

The output will be somewhat like this
>>>
Enter number 1 : 6
Enter number 2 : 6
The sum is  12

and for subtraction set n3=int(n1)-int(n2), for multiplication set n3=int(n1)*int(n2) and division set n3=int(n1)/int(n2)