How to calculate a mod b in Python?
There's the %
sign. It's not just for the remainder, it is the modulo operation.
you can also try divmod(x, y)
which returns a tuple (x // y, x % y)
There's the %
sign. It's not just for the remainder, it is the modulo operation.
you can also try divmod(x, y)
which returns a tuple (x // y, x % y)