+ 2
I don't understand modulo , the % symbol...help pls
3 Answers
+ 12
Modulo gives you the floor division remainder. Normally, if you divide 23 / 5, the result is 4.6
But if you divide it using floor division:
23 // 5 equals 4
There is a remainder, though, as 4 * 5 equals 20, not 23. And this remainder - 3 - is returned by the modulo sign:
23 % 5 = 3
+ 1
Thanks Kuba