Simple Python Program to Add Two Numbers in Two methods-learn easily within 1 minute

Python Program to Add Two Numbers


Here you will get python program to add two numbers. In this i am going to mention 2 methods

  • Add two number using Static method 
  • Add two number given by user


Method 1:

Python Program to Add Two Numbers(Static method )

a = 3                                          // variable declaration 
b = 8
sum = a + b                              // Arithmetic Calculation 
print("sum:", sum)                // display function

Output
sum: 11


Method 2:
Python Program to Add Two Number (Value given by User)

a = int(input("enter first number: "))        // variable declaration //user defined value 
b = int(input("enter second number: "))
sum = a + b                                                 // Arithmetic Calculation 
print("sum:", sum)                                     // display function

Output
enter first number:3
enter second number:8
sum: 11



If you any doubts, Please let me know

Previous Post Next Post

Contact Form