Arithmetic Operators in Python

There are 7 arithmetic operators in Python. The lists are given below:


Operator

Description

Syntax

Addition Operator

+

Addition: adds two operands

x + y

Subtraction Operator

Subtraction: subtracts two operands

x – y

Multiplication Operator

*

Multiplication: multiplies two operands

x * y

Division Operator

/

Division (float): divides the first operand by the second

x / y

Floor Division Operator

//

Division (floor): divides the first operand by the second

x // y

Modulus Operator

%

Modulus: returns the remainder when the first operand is divided by the second

x % y

Exponentiation Operator

**

Power (Exponent): Returns first raised to power second

x ** y

Precedence of Arithmetic Operators in Python

Let us see the precedence and associativity of Python Arithmetic operators.

Operator

Description

Associativity

**

Exponentiation Operator

right-to-left

%, *, /, //

Modulos, Multiplication, Division, and Floor Division

left-to-right

+, –

Addition and Subtraction operators

left-to-right

Python Arithmetic Operators

The Python operators are fundamental for performing mathematical calculations in programming languages like Python, Java, C++, and many others. Arithmetic operators are symbols used to perform mathematical operations on numerical values. In most programming languages, arithmetic operators include addition (+), subtraction (-), multiplication (*), division (/), and modulus (%).

Similar Reads

Arithmetic Operators in Python

There are 7 arithmetic operators in Python. The lists are given below:...

Addition Operator

In Python, + is the addition operator. It is used to add 2 values....

Subtraction Operator

In Python, – is the subtraction operator. It is used to subtract the second value from the first value....

Multiplication Operator

Python * operator is the multiplication operator. It is used to find the product of 2 values....

Division Operator

Python // operator is the division operator. It is used to find the quotient when the first operand is divided by the second....

Floor Division Operator

The // in Python is used to conduct the floor division. It is used to find the floor of the quotient when the first operand is divided by the second....

Modulus Operator

The % in Python is the modulus operator. It is used to find the remainder when the first operand is divided by the second....

Exponentiation Operator

In Python, ** is the exponentiation operator. It is used to raise the first operand to the power of the second....