+ 1
What is floor division?
6 ответов
+ 5
a//b == (a-(a%b))/b
+ 4
It removes the decimals of the result
+ 4
Floor division is integer division. The floating part or fractional part of the quotient is truncated (cut off) leaving only the integer part of the result.
try printing:
print(10 / 3)
vs
print(10 // 3)
+ 4
a//b == floor(a/b)
+ 4
Floor division (//) gives quotient while division (/) gives exact division answer.
e. g. 7//2=3 but 7/2=3.5
+ 4
It returns the floor of the division.