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

What does divmod mean in python

藏色散人
Release: 2019-07-05 09:57:39
Original
65283 people have browsed it

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)
Copy after login

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)
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template