5

Python: The divmod() function

 2 years ago
source link: https://proinsias.github.io/til/python-the-divmod-function/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Python: The divmod() function

less than 1 minute read

The [built-in] divmod() function returns a tuple containing the quotient and the remainder when argument1 (dividend) is divided by argument2 (divisor).

For example:

>>> x = divmod(5, 2)
>>> print(x)
(2, 1)

Via w3schools.com.

Tags: python til

Categories: til

Updated: October 25, 2021

Previous Next

You May Also Enjoy


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK