Javatpoint Logo
Javatpoint Logo

Python divmod() Function

Python divmod() function is used to get remainder and quotient of two numbers. This function takes two numeric arguments and returns a tuple. Both arguments are required and numeric. This function has the following syntax.

Signature

Parameters

number1: A numeric value, it is required.

number2: A numeric value, it is required.

Return

It returns a tuple.

Let's see some examples of divmod() function to understand it's functionality.

Python divmod() Function Example 1

Let's see a simple example to call divmod() function.

Output:

(5, 0)

Python divmod() Function Example 2

It also allows passing float values as an argument. See an example below.

Output:

(2.0, 0.5)

Python divmod() Function Example 3

Here, we are passing the first argument as integer and second as a float value.

Output:

(2.0, 1.5)

Next TopicPython Functions




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA