What does // operator mean in python?

10885

Table of Contents

What does // operator mean in python?

The // operator is used for floor division. It is similar to integer division as it returns the floor result instead of the actual result one might get from a normal division.

Examples of // operator

a = 15//4
print(a)

 

3

 

a = -15//4
print(a)

 

4

 

a = -10.0//4
print(a)

 

-3.0
a = -17//4.0
print(a)

 

-5.0