Unit 5 · Lesson 2
Build the idea
Start with the concept and its key vocabulary.
DIV and MOD describe two parts of the same division. In 17 divided by 5, there are 3 complete groups with 2 left over, so 17 DIV 5 is 3 and 17 MOD 5 is 2. Python writes these operators as // and %. They are useful for splitting minutes into hours, grouping items and spotting odd/even patterns.
Integer division that returns the whole-number quotient and discards the remainder.
An operation that returns the remainder after division.
The result of division; with DIV, only the whole-number part is returned.
The amount left after making as many complete groups as possible.