# How to Add Two Numbers in Python?

07-Oct-2022

.

Hi Dev,

This article will provide some of the most important example How to Add Two Numbers in Python. let’s discuss about Addition of two numbers in Python. I explained simply about Python Program To Add Two Numbers With Code Examples. I explained simply about How to Print Sum of Two Numbers in Python. Here, Creating a basic example of Sum of Two Numbers - Python Example Program.

Python program to add two numbers; Through this tutorial, you will learn how to add two numbers using + operator in python program.

let's see below simple example with output:

Example 1: Simple Python Program to Add Two Numbers

```# This program adds two variable
x = 10
y = 10

sum = x + y

# Display the sum
print("sum:", sum)
```

Output:

```sum: 20
```

Example 2: Python Program to Add Two Numbers with User Input

```# Store input numbers
x = int(input("enter first number: "))
y = int(input("enter second number: "))

sum = x + y

# Display the sum
print("sum:", sum)
```

Output:

```enter first number:10
enter second number:10
sum: 20
```

Example 3: Python Program to Add Two Numbers Using Functions

```# Program to illustrate
# the use of user-defined functions

sum = a + b
return sum

num1 = 10
num2 = 25

```sum: 35