Python divmod() FunctionPython 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. SignatureParametersnumber1: A numeric value, it is required. number2: A numeric value, it is required. ReturnIt returns a tuple. Let's see some examples of divmod() function to understand it's functionality. Python divmod() Function Example 1Let's see a simple example to call divmod() function. Output: (5, 0) Python divmod() Function Example 2It also allows passing float values as an argument. See an example below. Output: (2.0, 0.5) Python divmod() Function Example 3Here, we are passing the first argument as integer and second as a float value. Output: (2.0, 1.5) Next TopicPython Functions |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India