Home >Backend Development >Python Tutorial >What does divmod mean in python

What does divmod mean in python

藏色散人
藏色散人Original
2019-07-05 09:57:3965294browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:How to use idle in pythonNext article:How to use idle in python