Python divmod() function

Facebooktwitterredditpinterestlinkedinmailby feather

Python divmod() function

The divmod() function in Python returns a tuple containing the quotient  and the remainder when parameter ‘a’ (divident) is divided by parameter ‘b’ (divisor).

Syntax:

Parameter

a: This parameter represents a number you want to divide i.e., the dividend.

b: This parameter represents a number that you want to divide with i.e., the divisor.

Return

This function returns a pair of numbers consisting of their quotient and remainder.

Example 1

Output

Example 2

Output

 

Facebooktwitterredditpinterestlinkedinmailby feather