Python How to Add 2 Numbers: Easy Guide

Logan Jul 13, 2026

In the vast realm of programming, Python stands out as a powerful and versatile language, beloved for its simplicity and readability. One of the most fundamental operations in coding is Addition, a positive step towards solving complex algorithms. Today, we're going to explore how to add two numbers in Python, breaking down the process into digestible bits.

Addition of 2 numbers in Python
Addition of 2 numbers in Python

Before we dive in, it's essential to understand that Python supports both integer and floating-point arithmetic. This versatility allows us to work with whole numbers or decimals, making it a fantastic choice for both simple and complex mathematical tasks.

Simple Python Program to add Two number
Simple Python Program to add Two number

Python's Basic Addition Operations

Python makes addition as simple as it gets. You can add two numbers using the plus sign (+).

Sum of Two Numbers in Python or Adding Two Numbers
Sum of Two Numbers in Python or Adding Two Numbers

Let's begin with an elementary example:

```python # Add two integers num1 = 10 num2 = 5 print(num1 + num2) # Output: 15 ```

Adding Integers

Python if Example Even Odd - EasyCodeBook.com
Python if Example Even Odd - EasyCodeBook.com

The above example demonstrates how to add two integers in Python. The result, 15, is printed on the screen. Remember, integers in Python are whole numbers with no decimal points.

Now, let's add three numbers instead of two:

```python # Add three integers num1 = 10 num2 = 5 num3 = 7 print(num1 + num2 + num3) # Output: 22 ```

Adding More Than Two Numbers

Phyton
Phyton

Python allows us to add more than two numbers by simply separating them with the plus sign (+). The above script prints 22, summing up 10, 5, and 7.

Adding Floating Point Numbers

Python also supports adding decimal numbers (float) seamlessly. Let's see how it works:

20 Python Functions You Should Know
20 Python Functions You Should Know

```python # Add two floating point numbers num1 = 10.5 num2 = 7.5 print(num1 + num2) # Output: 18.0 ```

Adding Decimal Numbers

In the example above, we added two floating-point numbers. The result, 18.0, is printed, illustrating Python's support for decimal addition.

"6 Python List Methods Every Beginner Should Know"
"6 Python List Methods Every Beginner Should Know"
📘 Python for Beginners Notes 🐍🔥
📘 Python for Beginners Notes 🐍🔥
5 Python Tricks That Will Save You Hours of Coding
5 Python Tricks That Will Save You Hours of Coding
python
python
Pi in Python — How It Works?
Pi in Python — How It Works?
Top 5 Python Projects for Beginners 🚀 (Start Coding Today)
Top 5 Python Projects for Beginners 🚀 (Start Coding Today)
the numbers in python code are shown on this page, and it is not easy to read
the numbers in python code are shown on this page, and it is not easy to read
How to Create A Bouncing Ball in Python?
How to Create A Bouncing Ball in Python?
Python Decoded: Beginner Edition
Python Decoded: Beginner Edition
9 Secret Samsung Phone Features
9 Secret Samsung Phone Features
three different types of python programming
three different types of python programming
How To Iterate Through A List In Python, Choosing The Right Python Ide, Python List Methods Examples, Python List Methods Infographic, How To Implement One-to-many In Python, How To Use List Methods In Python, Best Ide For Python Development, Python List, Python Project Ideas List
How To Iterate Through A List In Python, Choosing The Right Python Ide, Python List Methods Examples, Python List Methods Infographic, How To Implement One-to-many In Python, How To Use List Methods In Python, Best Ide For Python Development, Python List, Python Project Ideas List
Python Functions Cheat Sheet
Python Functions Cheat Sheet
Python Tips (01)
Python Tips (01)
Make Money Coding Python
Make Money Coding Python
Python Beginner Roadmap 2026: Learn Python Step-by-Step From Zero to Job Ready
Python Beginner Roadmap 2026: Learn Python Step-by-Step From Zero to Job Ready
python programming for beginners free cheat sheet
python programming for beginners free cheat sheet
an info sheet with the words 10 python one - liners that will blow your mind
an info sheet with the words 10 python one - liners that will blow your mind

What happens when you mix integers and floats? Let's find out:

```python # Addition of integer and floating point number num1 = 10 num2 = 7.5 print(num1 + num2) # Output: 17.5 ```

Mixing Integers and Float in Addition

When you mix an integer and a floating-point number, the result will always be a float. To avoid unexpected outcomes, keep an eye on your data types.

You've now mastered Python's addition operations. Similar to driving a car, mastering the basics unlocks new opportunities to explore and solve complex problems. So, keep coding, and happy exploring!