Python math.remainder() - Remainder of x/y
Python math.remainder()
math.remainder(x, y) function returns the IEEE 754-style remainder of the division x/y. The remainder is the difference between x and the closest integer multiple of y.
Syntax
The syntax to call remainder() function is
math.remainder(x, y)where
| Parameter | Required | Description |
|---|---|---|
| x | Yes | A numeric value. |
| y | Yes | A numeric value. |
Example
The remainder of the division 8/2.3 using math.remainder().
Python Program
import math
x = 8
y = 2.3
result = math.remainder(x, y)
print('remainder() :', result)Output
remainder() : 1.1000000000000005Summary
In this Python Math tutorial, we learned the syntax of, and examples for math.remainder() function.