THE WORLD'S LARGEST WEB DEVELOPER SITE

Python divmod() Function

❮ Built-in Functions


Example

Display the quotient and the remainder of 5 divided by 2:

x = divmod(5, 2)
Run example »

Definition and Usage

The divmod() function returns a tuple containing the quotient  and the remainder when argument1 (divident) is divided by argument2 (divisor).


Syntax

divmod(divident, divisor)

Parameter Values

Parameter Description
divident A Number. The number you want to divide
divisor A Number. The number you want to divide with

❮ Built-in Functions