Integer division & modulo operation with negative operands in Python

The integer division there is just taking the floor of the number obtained at the end.

10/3  -> floor(3.33)  ->  3
-10/3 -> floor(-3.33) -> -4

(Why it floors)


The modulo operation on the other hand is following the mathematical definition.

Leave a Comment