search

What is the use of the "divmod" function in Python?

The "divmod" function in Python returns the pair of numbers: the floor division and the modulo operation. The floor division is the result of the division of two numbers rounded towards minus infinity. The modulo operation returns the remainder of the floor division. The "divmod" function takes two arguments, the numerator and the denominator, and returns a tuple of two values: the floor division result and the modulo result. 

The syntax is as follows:

divmod(numerator, denominator)

Related Questions You Might Be Interested