Python Modulus Operator

In Python, Arithmetic Modulus Operator takes two operands and returns the remainder of their integer division.

Syntax

The syntax to find the remainder in the division of numbers: a and b using Modulus Operator is

a % b

The above expression returns a number.

ADVERTISEMENT

Example

In the following program, we take two numbers: a, b; and find the remainder in the integer division a / b.

main.py

a = 6
b = 4

result = a % b

print(result)
Try Online

Output

2

Conclusion

In this Python Tutorial, we learned about Arithmetic Modulus Operator, its syntax, and usage, with examples.