Python divmod() Function
Example
Display the quotient and the remainder of 5 divided by 2:
x = divmod(5, 2)
Try it Yourself »
Definition and Usage
The divmod()
function returns a tuple
containing the quotient and the remainder when argument1 (dividend) is
divided by argument2 (divisor).
Syntax
divmod(dividend, divisor)
Parameter Values
Parameter | Description |
---|---|
dividend | A Number. The number you want to divide |
divisor | A Number. The number you want to divide with |