divmod(x,y)
Sometimes you want both the quotient and remainder when
dividing by
x. This
function returns a tuple y(, where q, r) is
the quotient and q is the remainder.
r
If either
or x is a
yfloat, the returned value is the whole part
of the quotient, and the returned q is computed as r.
x-(r*d)
Examples:
>>> divmod(13, 5) (2, 3) >>> divmod(1.6, 0.5) (3.0, 0.10000000000000009)