3 ms·
True. I checked the python reference again and it re-adjusts the modulo to have the same sign as the 2nd operand. >>> 1 % -3 -2 >>> -1 % -3 -1
by newt0311 19y ago
True. I checked the python reference again and it re-adjusts the modulo to have the same sign as the 2nd operand.
>>> 1 % -3
-2
>>> -1 % -3
-1