Home >>Python math Module >Python math.fmod() Method
Python math.fmod() method in python is used to returns modulus in float type of a specified number when a number is divided by another number and it accepts two arguments (the first parameter is known as dividend and the second parameter is known as divisor).
Syntax:math.fmod(x, y)
Parameter | Description |
---|---|
X | It is required a number to divide |
Y | It is required a number to divide with |
import math
print (math.fmod(12, 2))
print (math.fmod(15, 8))
print (math.fmod(10, 10))
import math
x = 2
y = 7
result = math.fmod(x,y)
print("result = ", result)
x = 6
y = -9
result = math.fmod(x,y)
print("result = ", result)
x = 9.17
y = 6.25
result = math.fmod(x,y)
print("result = ", result)