Python math.fmod() Method
Example
Return the remainder of x/y:
# Import math Library
import math
# Return the remainder after
modulo operation
print (math.fmod(67, 7))
print (math.fmod(17, 4))
print (math.fmod(16, 4))
Try it Yourself »
Definition and Usage
The math.fmod()
method returns the remainder of specified numbers when a number is divided by another number.
The number returned represents the counterclockwise angle in radians (not degrees) between the positive X-axis and the point (x, y).
The number we get in return is between PI and -PI.
Syntax
math.fmod(x, y)
Parameter Values
Parameter | Description |
---|---|
x | Required. The number you want to divide |
y | Required. The number you want to divide with |
Note: If x and y = 0, then this method returns a ValueError.
Note: If the second parameter, y, = 0, then it returns a ValueError.
Note: If x and y have a value that is not a number, it returns a TypeError.
Technical Details
Return Value: | A float value, representing the remainder when a number is divided by another number |
---|---|
Python Version: | 1.4 |