Kalebu Jordan

Become a Pro Python Developer

On tutorial We will create a Simple Python Program to Add two numbers .

The instructions should look like this

• Instructing computer what our two numbers are
• Calculating the sum of two numbers
• Displaying the sum of two numbers to the screen

Let’s first create a Program given the two numbers are predefined

add.py

```#________Python program to add two numbers_________
first_number = 14
second_number = 26

summation = first_number + second_number
print("The sum of two numbers is ", summation)```

Running our Program

```\$ python add.py
The sum of two numbers is 40```

Let’s create program where two numbers are entered by user

On getting input from user were going to use input () together with int () function to converted entered number to integer .

adding.py

```#------Python program to Add Two numbers-------
first_number = int(input("Enter the first number: "))
second_number = int(input("Enter the second number: "))

summation = first_number + second_number
print("The sum of two numberts is ", summation)```

Running our program

```\$ python adding.py
Enter the first number: 56
Enter the second number: 90
The sum of two numberts is  146```