What is the // operator in Python?

The // operator is known as the Floor division operator in Python; it is used for integer division i.e the result of the division is rounded to the closest smaller integer. To put it more simply, anything to the right of the decimal point (the remainder) is left off.

import math
# We'll divide 7 by 3, using the '/' and '//' to see the difference
print("Standard division: ", 7/3)
print("Taking floor after standard division:", math.floor(7/3) )
print("Floor division: ", 7//3)
svg viewer

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved