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

ParameterRequiredDescription
xYesA numeric value.
yYesA 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)
Run Code Copy

Output

remainder() : 1.1000000000000005

Summary

In this Python Math tutorial, we learned the syntax of, and examples for math.remainder() function.

Code copied to clipboard successfully 👍