+ 2
How does modulo works when first number is smaller than the second?
I tried 2%5 in Python and it returns 2. Even 2%4 and 2%6 returns the same 2 as result. Why is that so?
1 Answer
+ 3
You know that the modulo returns the remainder. So, what's happening is that the smaller number is not divisible by the larger, so the smaller number IS the remainder. "5 goes into 2 zero times with 2 still remaining"