Email: Password:       Forgot Password 
A Saarsha Group Online Community for dot net codes group like C#, Asp.NET, VB.NET, Sharepoint, JavaScript, JQuery, Ajax, SQL, WCF, WPF.

Python - Adding 2 Numbers

Viewed:  873 
Posted On:  23/05/2015 07:14:39 
Hi all,With the help of this article i am going to tell you that how we can print the addition of numbers..  


Here I am going to show how we can add 2 numbers by using python.

First you should know What is Python?

Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Guido van Rossum is the creator of Python with its first implementation in 1989. Its high-level built in data structures, combined with dynamic typing and dynamic binding; make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together.

Programmers fall in love with Python because of the increased productivity it provides. Since there is no compilation step, the edit-test-debug cycle is incredibly fast. Debugging Python programs is easy: a bug or bad input will never cause a segmentation fault. Instead, when the interpreter discovers an error, it raises an exception.
When the program doesn't catch the exception, the interpreter prints a stack trace. A source level debugger allows inspection of local and global variables, evaluation of arbitrary expressions, setting breakpoints, stepping through the code a line at a time, and so on. The debugger is written in Python itself, testifying to Python's introspective power.

Now we will learn step by step: adding of 2 numbers.

Script  is :-

Step 1: Open IDLE (Python GUI) in your system.

Step 2 : Type the below code and save the code Eg:- I have saved with script name.

a = 12
b = 13
c = 2

d = a+b
e = b+c
f = c+a

print("the value of a is ",a)
print("the value of b is ",b)
print("the value of c is ",c)

print("the sum of a & b is ",d)
print("the sum of b & c is ",e)
print("the sum of c & a is ",f)

Step 3 :
 Open command prompt.

Step 4 : Go to the saved script folder.

Step 5 : Write python <Script name>.py  for execution.(Eg.- python


         HOME   |   Submit Article   |   Contact Us   |   About Us   |   Terms & Condition   |   Advertise With us