Get the quotient and remainder of a division in Python

The divmod(), a Python built-in function, returns the quotient and remainder of a division.

a = divmod(17, 3)

print(a)  # (5, 2)
print(type(a))  # <class 'tuple'>

5 is a quotient and remainder is 2. The return's type is tuple.

Python Math

Python Tutorial