# Python Double Slash (//) Operator

Python Double Slash (//) Operator is used to perform floor division. It divides the first number by the second number and rounds the result down to the nearest integer (or whole number).

``firstNum // secondNum``

## Python Double Slash (//) Operator

Simple example code.

``````num1 = 12
num2 = 9
num3 = num1 // num2

print("floor division of", num1, "by", num2, "=", num3)
``````

Output:

Division using single slash (/) and double slash (//) operator

``````num1 = 5
num2 = 2

result = num1 / num2

print("The division result of %d/%d = %0.2f" % (num1, num2, result))
print(type(result))

# Divide using double slash
result = num1 // num2

print("The division result of %d//%d = %0.2f" % (num1, num2, result))
print(type(result))

# Divide using double slash and float divisor value
result = num1 // float(num2)
print("The division result of %d//%0.2f = %0.2f" % (num1, num2, result))
print(type(result))

# Divide using double slash and float divider value
result = float(num1) // num2
print("The division result of %0.2f//%d = %0.2f" % (num1, num2, result))
print(type(result))
``````

Output:

``````The division result of 5/2 = 2.50
<class 'float'>
The division result of 5//2 = 2.00
<class 'int'>
The division result of 5//2.00 = 2.00
<class 'float'>
The division result of 5.00//2 = 2.00
<class 'float'>``````

Do comment if you have any doubts or suggestions on this Python operator topic.

Note: IDE: PyCharm 2021.3.3 (Community Edition)

Windows 10

Python 3.10.1

All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.