The divmod() function is used to get the quotient and remainder of two numbers when they are divided.

It takes two arguments, which are the two numbers to be divided and returns a tuple of two integers, the first integer is the quotient and the other is the remainder of the division.

The divmod() function does not perform the normal division but rather the floor division.

divmod(a, b)
print(divmod(5, 2))
print(divmod(9, 3))
print(divmod(-7, 9))

The function is useful in performing some essential operations, for example it can be used to obtain both the quotient (whole number) and the remainder (decimal number) of a floating point value.

print(divmod(14.3, 1))
print(divmod(5.6, 1))
print(divmod(9.8, 1))