Skip to content
Built-in Functions

divmod()

Get a quotient and remainder together.

divmod(a, b)

divmod() divides one number by another and returns two results at once: the whole-number quotient and the remainder.

Parameters

NameDescription
aThe number to divide.
bThe number to divide by.

Returns

A two-item tuple: (quotient, remainder).

Try it

Run it and change it
quotient, remainder = divmod(17, 5)
print(quotient, remainder)

Related entries