0
20//6=3
I can't understand it plzz help
3 ответов
+ 3
// is floor division in python. It finds the quotient when 2 numbers are divided. The catch is it must me a whole number and can have a remainder
In this case 20 // 6 has quotient 3 and remainder 2.
In other words floor division floors (rounds off to the nearest interest lesser or equal to it) the quotient.
In real division, 20 ÷ 6 = 3.333333...... but in floor division 3.3333... gets floored and becomes 3 and remainder is then 2. (as 3 × 6 +2 = 20)
Extra info: The opposite of flooring is ceiling. Ceiling rounds the number to the nearest integer greater or equal to it.
+ 2
No, it is not the same as % YUGABDH PASHTE
20%6 = 2
20//6 is integer division. Meaning everything after the decimal point gets cropped. Also known as floor division like S. C. mentioned
+ 2
x//y simply means ignore the fractional part but give me the whole number part.
==> 20//6 == 3.