Modulo Operator

How does a modulo operator works, exactly :thinking:

I wanted to get a remainder from division of 1 by 3, which resulted in 1. But how was it calculated?

I looked up a general formula n = kd + r, r < d
E.g., 8%3 in Python would result in 2, since 8 = (2 * 3) + 2, where r = 2. I can substitute numbers in that case, but I can’t work them out for 1 and 3.

Please help :sob::sob::sob:

you can apply the same formula:
1 = (0 * 3) + 1

I don’t see the problem?

1 Like

Hm, really :thinking:

I don’t see the problem now, either :3
Thank you! Thanks for a quick response!

I messed up, I edited the formula

now its correct, the left-hand side of the equal sign (1) equals the right hand side: (0 * 3) + 1

you are right thank you so much for your answer