Python Tutorial

What Are Python Arithmetic Operators? Types of Arithmetic Operators With Example

What is Python Arithmetic Operator?

Addition, subtraction, multiplication, & division are some instances of mathematical operations performed using arithmetic operators.

Different Types of Python Arithmetic Operators

Python has seven arithmetic operators:

1. Addition

2. Subtraction

3. Multiplication

4. Division

5. Modulus

6. Exponentiation

7. Floor division

  • Addition Operator

The addition operator in Python is +. It's used to combine two numbers.

Example:

v1 = 12

v2 = 13

res = v1 + v2

print(res)

Output:

25
  • Subtraction Operator

The subtraction operator in Python is –. It's used to take the second number and subtract it from the first.

Example:

v1 = 22

v2 = 13

# using the subtraction operator

res = v1 - v2

print(res)

Output :

9
  • Multiplication Operator

The subtraction operator in Python is –. It's used to take the second number and subtract it from the first.

Example:

v1 = 2

v2 = 3

res = v1 * v2

print(res)

Output:

6
  • Division Operator

The division operator in Python is /. It is utilized to get the quotient.

Example:

v1 = 30

v2 = 2

res = v1 / v2

print(res)

Output:

15
  • Modulus Operator

The modulus operator in Python is percent. It is utilised to get the remainder.

Example:

v1 = 3

v2 = 2

res = v1 % v2

print(res)

Output 

1
  • Exponentiation Operator 

** is the exponentiation operator in Python. It's used to multiply the first operand by the second operand's power.

Example:

v1 = 2

v2 = 3

 res = v1 ** v2

print(res)

Output :

8
  • Floor division

The floor division in Python is done using //. It is utilized to get the quotient's floor.

Example:

v1 = 3

v2 = 2 

# using the floor division

res = v1 // v2

print(res)

Output :

1

Below is the summary of all the arithmetic operators in Python:

arithmetic operators in Python

Test your knowledge with a quick quiz!

The truncation division operator in Python is which of the following?

Select the correct answer

Did you find this article helpful?