Python basis --divmod () function

Python basis --divmod () function

python divmod () function is the remainder and divisor calculation result combined, returns a tuple containing the quotient and remainder of (a // b, a% b).

Before python 2.3 version does not allow processing complex.

Function Syntax

divmod(a, b)

Parameter Description:

a: Digital
b: Digital

Examples

divmod(7,2) #得到(3,1)
divmod(8,2) #得到(4,0)
divmod(1+2j,1+0.5j) #得到((1+0j),1.5j)
Published 165 original articles · won praise 5 · Views 8626

Guess you like

Origin blog.csdn.net/linjiayina/article/details/104360943