Skip to content

Arithmetic Operators

What are Arithmetic Operators

Arithmetic operators are symbols that performs mathematical operations

There are seven arithmetic operators in Python

Here is an overview of arithmetic operators

OperatorDescriptionExample
+Additionx + y = 30
-Substractionx - y = 10
-Multiplicationx * y = 200
-Divisionx / y = 2.0
-Floor Divisionx // y = 2
-Exponentx ** y = 4 # if x = 2, y = 2
%Modulusx % y = 0

Addition Operator

Addition operator represented by + adds the object(value) on its left with object(value) on its right and then returns the result

Example

example of addition operator
>>>
>>> #
>>> 5 + 9
14
>>>
>>>
>>>
>>>

Subtraction Operator

Substraction operator symbolised by - subtracts the value on its right from the value on its left and then returns the result.

Example

example of subtraction operator
>>>
>>> #
>>> 11 - 9
2
>>>
>>>
>>>
>>>

Multiplication Operator

Multiplication operator represented by * multiplies the operand(value) on its left by the value or object on its right, and returns the result.

Example

example of multiplication operator
>>>
>>> 10 * 5
50
>>>
>>>
>>>
>>>
>>>

Division Operator

Division operator represented by / divides the value or object on the its left by the operand(value) on its right, and then returns the result.

Example

example of division operator
>>>
>>>
>>> 30 / 3
10.0
>>>
>>>
>>>
>>>
>>>

Floor Division Operator

Floor Division operator represented by // divides the value or object on the its left by the operand(value) on its right, and then returns the result by discarding the floating points.

Example

example of floor division operator
>>>
>>> 30 // 3
10
>>>
>>> 10 // 3
3
>>>
>>>

Exponentiation Operator

Example

example of exponentiation operator
>>>
>>> 5 ** 2
25
>>>
>>> 2 * 5
32
>>>
>>>
>>>

Modulus Operator

Modulus operator represented by % divides the value or object on the its left by the operand(value) on its right, and then returns the remainder.

Example

example of modulus operator
>>>
>>> 20 % 10
0
>>>
>>> 10 % 3
1
>>>
>>>
>>>