The modf method of the math module
The modf method of the math module returns a tuple consisting of the fractional and integer parts of the given number.
Syntax
import math
math.modf(number)
Example
Let's find out the fractional and integer parts of the number 20:
import math
print(math.modf(20))
Result of code execution:
(0.0, 20.0)
Example
Now let's apply the modf method to the number 20.56:
import math
print(math.modf(20.56))
Result of code execution:
(0.5599999999999987, 20.0)