Python divmod() Function
The Python divmod() function returns quotient and remainder of a division operation. It requires two parameter, first for dividend and second for divisor and returns values in a tuple form containing quotient and remainder.
Syntax
divmod(dividend, divisor)
Parameters
dividend |
Required. A number which need to be divided. |
divisor |
Required. A number with which a dividend need to be divided. |
Example:
In the example below, divmod() function is used to find out the quotient and remainder of a given division operation.
a = 83 b = 10 print(divmod(a, b))
The output of the above code will be:
(8, 3)
❮ Python Built-in Functions