Table of contents
1.
Introduction 
2.
What are Arithmetic Operators in Python?
3.
Operators in Python
4.
Types of Python Arithmetic Operators
4.1.
Addition (+)
4.2.
Python
4.3.
Subtraction (-)
4.4.
Python
4.5.
Multiplication (*)
4.6.
Python
4.7.
Division (/)
4.8.
Python
4.9.
Modulus (%)
4.10.
Python
4.11.
Floor Division (//)
4.12.
Python
4.13.
Exponentiation (**)
4.14.
Python
5.
Precedence Order of Python Arithmetic Operators
6.
Example to Implement Arithmetic Operators in Python
6.1.
Python
7.
Mastering Arithmetic Operations in Python
8.
Applying Python Arithmetic Operators for Calculations
8.1.
Python
9.
Frequently Asked Questions 
9.1.
How to do arithmetic in Python? 
9.2.
What is an arithmetic operator?
9.3.
What data type are arithmetic operators in Python?
10.
Conclusion
Last Updated: Aug 21, 2025
Easy

Python Arithmetic Operators

Introduction 

In programming, arithmetic operators are fundamental tools used for performing mathematical calculations. In Python, arithmetic operators enable you to conduct basic operations such as addition, subtraction, multiplication, and division, which are essential for a wide range of applications, from simple calculations to complex algorithms.

Python's arithmetic operators are straightforward and easy to use, providing a clean syntax for performing mathematical operations on numeric data types. 

Python Arithmetic Operators

This article discusses the Python Arithmetic Operators along with examples. Before we start, let us have a look at different types of Operators in Python. 

What are Arithmetic Operators in Python?

Arithmetic operators in Python are used to perform basic mathematical operations on numeric values. These operators work with integers and floating-point numbers, and they include:

1. Addition (+): Adds two numbers.

  • Example: 5 + 3 results in 8.

2. Subtraction (-): Subtracts the second number from the first.

  • Example: 10 - 4 results in 6.

3. Multiplication (*): Multiplies two numbers.

  • Example: 7 * 6 results in 42.

4. Division (/): Divides the first number by the second, always returning a floating-point result.

  • Example: 8 / 2 results in 4.0.

5. Floor Division (//): Divides the first number by the second, returning the largest integer less than or equal to the result.

  • Example: 9 // 2 results in 4.

6. Modulus (%): Returns the remainder of the division of the first number by the second.

  • Example: 10 % 3 results in 1.

7. Exponentiation (**): Raises the first number to the power of the second number.

  • Example: 2 ** 3 results in 8.

Operators in Python

Operators are essential in Python programming as they enable us to perform various operations and manipulate data in a simple and efficient way. 

Here are some reasons why operators are important in any programming language: 

  • Assign values
  • Work with data types
  • Manipulate strings
  • Comparison and logical operations
  • Perform calculations


Python provides different types of operators like Arithmetic Operators, Logical Operators, Comparison Operators, Identity OperatorsBitwise Operators, Assignment Operators, and Membership Operators. 

Types of Operators

This article discusses the Arithmetic Operators in detail. So let us start. 

Types of Python Arithmetic Operators

Arithmetic operators are used to perform various mathematical operations such as addition, multiplication, division, subtraction, etc.

The following are the arithmetic operators in Python:

  • Addition (+)
  • Subtraction (-)
  • Multiplication (*)
  • Division (/)
  • Modulus (%)
  • Floor Division (//)
  • Exponentiation (**)

Operator

Meaning

Syntax

+

Adds two symbols

a + b 

-

Subtracts two operand

a - b 

*

Multiplies two operand

a * b

/

Divides two operand

a / b

//

Divides two operands, then takes their floor value

a // b

%

Finds the remainder, then the left operand is divided by the right operand

a % b

**

Finds the left operand raised to the power of right operand

a ** b

Let us discuss them in detail by taking examples: 

Addition (+)

The addition (+) operator performs addition between two operands. 

Example 

  • Python

Python

x = 5
y = 3
print(x + y)
You can also try this code with Online Python Compiler
Run Code


Output

8


Note that these operators can also be used in combination with assignment operators to modify the value of a variable. 

For example, x += y is equivalent to x = x + y.

Subtraction (-)

The subtraction (-) operator performs subtraction between two operands. 

It subtracts one value from another.

Example 

  • Python

Python

x = 5
y = 3
print(x - y)
You can also try this code with Online Python Compiler
Run Code


Output

2

Multiplication (*)

This operator performs multiplication between two operands. 

Example 

  • Python

Python

x = 5
y = 3
print(x * y)
You can also try this code with Online Python Compiler
Run Code


Output

15

Division (/)

The division operator (/) divides one value by another. Returns a float value even if the result is a whole number.

Example 

  • Python

Python

x = 12
y = 3
print(x / y)
You can also try this code with Online Python Compiler
Run Code


Output

4.0

Modulus (%)

The modulus operator (%) divides one value by another and returns the remainder.

Example 

  • Python

Python

x = 5
y = 2
print(x % y)
You can also try this code with Online Python Compiler
Run Code


Output

1

Floor Division (//)

The floor division operator ( //) divides one value by another and returns the quotient without the remainder (rounded down to the nearest integer).

Example 

  • Python

Python

x = 15
y = 2
print(x // y)
You can also try this code with Online Python Compiler
Run Code


Output

7

Exponentiation (**)

The exponential operator ( **) raises a number to the power of another number. It is used to perform exponentiation operations on numerical data types such as integers, floats, and complex numbers. 

Example 

  • Python

Python

x = 2
y = 5
print(x ** y) #same as 2*2*2*2*2
You can also try this code with Online Python Compiler
Run Code


Output

32

Precedence Order of Python Arithmetic Operators

In Python, the precedence of arithmetic operators is as follows (from highest to lowest precedence):

  • Exponentiation (**)
  • Multiplication (*), Division (/), Modular (%),  and Floor Division (//) (same precedence)
  • Addition (+) and Subtraction (-) (same precedence)
Precedence Order

This means that the ** operator has the highest precedence and will be evaluated first, followed by *, /, // (if present in the expression), and then + and - (if present in the expression).

It's important to note that you can use parentheses to change the order of evaluation, just like in regular algebra. Expressions inside parentheses are always evaluated first, regardless of operator precedence. 

Example to Implement Arithmetic Operators in Python

Here is an example of how to implement arithmetic operators in Python:

  • Python

Python

# Define variables
a = 10
b = 5

# Addition
c = a + b
print("Addition: ", c)

# Subtraction
d = a - b
print("Subtraction: ", d)

# Multiplication
e = a * b
print("Multiplication: ", e)

# Division
f = a / b
print("Division: ", f)

# Modulus
g = a % b
print("Modulus: ", g)

# Exponentiation
h = a ** b
print("Exponentiation: ", h)
You can also try this code with Online Python Compiler
Run Code

Here in this code, we defined two variables, a and b, and performed arithmetic operations on them.

Output:

Addition:  15
Subtraction:  5
Multiplication:  50
Division:  2
Modulus:  0
Exponentiation:  100

Mastering Arithmetic Operations in Python

Mastering arithmetic operations in Python is fundamental for any programming task that involves numerical computations. Python's arithmetic operators provide a straightforward way to perform basic mathematical calculations, making them essential tools for data analysis, algorithm development, and problem-solving.

By understanding and effectively using these operators, you can perform a wide range of calculations, from simple additions and subtractions to more complex operations like exponentiation and modular arithmetic. Mastery of these operations also involves understanding how Python handles different data types and operations, ensuring accurate results and efficient code.

Applying Python Arithmetic Operators for Calculations

Python's arithmetic operators are versatile and can be used for various types of calculations. Here are examples illustrating their application:

  • Addition (+): Adds two numbers together.
  • Subtraction (-): Subtracts one number from another.
  • Multiplication (*): Multiplies two numbers.
  • Division (/): Divides one number by another, returning a float.
  • Floor Division (//): Divides one number by another and returns the integer part of the quotient.
  • Modulus (%): Returns the remainder of the division.
  • Exponentiation (**): Raises a number to the power of another number.
  • Python

Python

# Define variables
a = 15
b = 4

# Perform arithmetic operations
addition = a + b
subtraction = a - b
multiplication = a * b
division = a / b
floor_division = a // b
modulus = a % b
exponentiation = a ** b

# Print results
print("Addition: ", addition)
print("Subtraction: ", subtraction)
print("Multiplication: ", multiplication)
print("Division: ", division)
print("Floor Division: ", floor_division)
print("Modulus: ", modulus)
print("Exponentiation: ", exponentiation)
You can also try this code with Online Python Compiler
Run Code

Output

Addition:            19
Subtraction:         11
Multiplication:      60
Division:            3.75
Floor Division:      3
Modulus:             3
Exponentiation:      50625

 

Frequently Asked Questions 

How to do arithmetic in Python? 

In order to do arithmetic operations in Python, use the arithmetic operators on numbers. For example, to add two numbers, we would use the addition operator (+), like 10 + 6.

What is an arithmetic operator?

An arithmetic operator is nothing but a symbol which is used to perform mathematical operations on numbers. The arithmetic operators in Python are addition (+), subtraction (-), multiplication (*), division (/), modulus (%), and exponentiation (**).

What data type are arithmetic operators in Python?

In Python, the arithmetic operators are always evaluated to the data type of the operands. For example, if the operands are integers, the result of the operation will be an integer. If the operands are floats, the result of the operation will be a float.

Conclusion

In this article, we have discussed Python Arithmetic Operators in detail. We have also discussed the precedence order of each operator. 

Recommended Readings:

Live masterclass