Python daily one function-divmod numeric processing function
Divmod (A, B) function
English Description:
The Divmod (A, B) method returns a a//b (division rounding) and a to B remainder
Returns a result type of tuple
Parameters:
A, B can be a number (including plural)
Version:
It is not allowed to deal with complex numbers before the python2.3 version, so let's pay attention.
English Description:
Take the non complex numbers as arguments and return a pair of numbers consisting of their quotient and remainder when u Sing Long division. With mixed operand types, the rules for binary arithmetic operators apply. For plain and long integers, the result is the same as (A//b, a% b). For floating point numbers the result was (q, a% b), where q is usually Math.floor (A/b) but could be 1 less than that. In any case Q * b + a% B are very close to a, if a% B is non-zero it had the same sign as B, and 0 <= abs (a% B) < ABS (b).
Changed in version 2.3:using Divmod () with complex numbers is deprecated.
Python code example:
>>> Divmod (9,2) (4, 1) >>> Divmod (11,3) (3, 2) >>> Divmod (1+2j,1+0.5j) ((1+0j), 1.5j)