Python: The divmod() function
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.
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.
Categories: til
Updated: October 25, 2021
You May Also Enjoy
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK