Related Tags

floating point
round down
python
divide
numerical operator

# What are division operators in Python? Educative Answers Team

If you tried to equally divide an unequal amount of candies, you would be left with a few remaining candies. In division, those that remain are called remainders.

What do we do with this remainder? Do we display the number as a floating point or do we round it down to the closest whole number?

Python has an answer with its division operators.

## Types of division operators in Python

In Python, there are two types of division operators:

• /: Divides the number on its left by the number on its right and returns a floating point value.

• //: Divides the number on its left by the number on its right, rounds down the answer, and returns a whole number.

The illustration below shows how this works.

## Examples

Now that we know how the operators work and what kind of division each operator performs; let’s look at an example of division in Python.

# Dividing an integer by an integer
print(5/2)
print(5//2)
print("\n")

# Dividing an integer by a float
print(5/2.75)
print(5//2.75)
print("\n")

#Dividing a float by an integer
print(5.5/2)
print(5.5//2)
print("\n")

#Dividing a float by an float
print(5.5/2.5)
print(5.5//2.5)

RELATED TAGS

floating point
round down
python
divide
numerical operator 