0

I don't understand the floor division and the module operator

Python

14th Mar 2020, 7:23 PM
Maduanusi Victor
Maduanusi Victor - avatar
2 odpowiedzi
0
Think of floor division as how many times the number will go into the other with no decimals. Eg. 10//3 will equal 3 instead of 3.33333. Module is like thinking of how many integers you are from being even. Eg. 10%3 = 1 because 3 can go evenly into 9 which is one away from 10. 9%3 = 0 because it divides evenly into 9 with no remainder. Hope that helps but I am sure there are lots of people who will reply to this comment with good explanations.
14th Mar 2020, 7:35 PM
DAYLINER BAND
DAYLINER BAND - avatar
0
To add to what Derick Smith said, floor is basically taking only the non-decimal part of the answer of the division. Modulo (or modulus, I forget which is the correct name. It's the % symbol) just takes the remainder of the 2 numbers.
15th Mar 2020, 1:38 AM
The Boxed Person
The Boxed Person - avatar