Python divmod() Function

Example

Display the quotient and remainder of 5 divided by 2:

x = divmod(5, 2)

Run Instance

Definition and Usage

The divmod() function returns a tuple containing the quotient and remainder when parameter 1 is divided by parameter 2.

Syntax

divmod(dividend, divisor)

Parameter Value

Parameter Description
dividend Number. Dividend.
divisor Number. Divisor.