Home >Backend Development >Python Tutorial >What does divmod mean in python
What does divmod mean in python?
divmod() in python is a built-in function. The python divmod() function combines the results of the divisor and remainder operations and returns a tuple containing the quotient and remainder (a // b, a % b).
Prior to Python 2.3, complex numbers are not allowed to be processed.
Function syntax
divmod(a, b)
Parameter description:
a: Number
b: Number
Instance
>>>divmod(7, 2) (3, 1) >>> divmod(8, 2) (4, 0) >>> divmod(1+2j,1+0.5j) ((1+0j), 1.5j)
Related recommendations: "Python Tutorial"
The above is the detailed content of What does divmod mean in python. For more information, please follow other related articles on the PHP Chinese website!