Python math.remainder() Method

Math Methods : Return the remainder of x with respect to y

Definition and Usage

The math.remainder() method returns the remainder of x with respect to y.

Syntax

math.remainder(x, y)

Parameter Values

Parameter Description
x Required. The number you want to divide.
y Required. The number you want to divide with. It must be a non-zero number, or a ValueError occurs.

Technical Details

Return Value: A float value, representing the remainder
Python Version: 3.7

More Examples

Example

Return the remainder of x/y:

print (math.remainder(23.5, 5))
print (math.remainder(23, 5.5))
print (math.remainder(12.5, 2.5))
print (math.remainder(12, 2))