Built-in Functions
divmod()
Get a quotient and remainder together.
divmod(a, b)
divmod() divides one number by another and returns two results at once: the whole-number quotient and the remainder.
Arguments
Parameters
| Name | Description |
|---|---|
| a | The number to divide. |
| b | The number to divide by. |
Result
Returns
A two-item tuple: (quotient, remainder).
Run it
Try it
Run it and change it
quotient, remainder = divmod(17, 5) print(quotient, remainder)
Output
Press Run to see what it prints.