## Introduction

The divmod() function is used to divide and return the result as an integer and the remainder of the two entered numbers. This is a common math operation in python to help solve math problems. Maybe it will help a lot in the school’s math program.

And we will show you how to use the divmod() function in Python as you go through it below. Hope you understand.

## Example

x = divmod(7, 2) print(x)

Output:

(3, 1)

## Definition

The divmod() function returns 2 values: integer and remainder.

## The syntax

divmod(x, y)

**Parameter Values**:

x: dividend y: divisor

## More examples

**Example 1**: Basic divmod()

x = divmod(9, 4) y = divmod(7, 2) print("x = ", x) print("y = ", y)

Output:

x = (2, 1)y = (3, 1)

**Example 2**:

divmod() combines input() function print("Enter x number:") x = int(input()) print("Enter y number:") y = int(input()) z = divmod(x, y) print("Result: ",z)

Output:

Enter x number: 5Enter y number: 2Result: (2, 1)

## Conclusion

Hope you understood the tutorial on how to use the divmod() function in Python.

Thanks for reading!

I am the Founder of Clipping Path Creative Ltd (Outsource Photo Editing Company) based in the UK. Also, I am a professional WordPress expert and working on Fiverr since 2016. I am offering all kinds of WordPress issues fix, Content upload and formatting, providing & installing SSL, Website migration, and website creation at affordable prices. Already achieved 5000+ reviews on Fiverr.