This website collects cookies to deliver better user experience
Python divmod()
Python divmod()
ItsMyCode |
The divmod() in Python is a built-in function that takes two numbers as input parameters and returns a pair of numbers ( a tuple ) consisting of their quotient and remainder.
divmod() Syntax
The syntax of divmod() is:
**divmod(_dividend_, _divisor_)**
divmod() Parameters
divmod() takes two parameters as input
dividend – The number you want to divide. A non-complex number (numerator)
divisor – The number you want to divide with. A non-complex number (denominator)
divmod() Return Value
divmod() returns a pair of numbers (a tuple) consisting of quotient and remainder.
If x and y are integers, the return value from divmod() is (x / y, x % y)
If x or y is a float, the result is*(q, x % y)*, where qis the whole part of the quotient.