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 differenceprint("Standard division: ", 7/3)print("Taking floor after standard division:", math.floor(7/3) )print("Floor division: ", 7//3)
Free Resources