A page number and offset are the quotient and remainder of the same division. divmod returns both from one operation.
Worked example
print(divmod(3671, 60))Result
(61, 11)Implementation notes
Negative operands follow Python's floor-division rules. Confirm the expected quotient and remainder if your page offsets can run backwards.
Try it yourself
Use the exact last slot on a page, followed by the first slot on the next.
Open the Python example →Editorial date August 23, 2026 · Published December 6, 2026