Learn and Learn

Learn And Learn - great place for tutorials, references and how-to

Python fmod() Function

math.fmod() is a function from Standard math Library of Python Programming Language. This function is used to calculate the module value of given parameters x and y.
 

Syntax of fmod() Function in Python

The syntax of fmod() function in python is:
math.fmod( x,y )

 

Parameters in fmod() Function

x Any valid Python number (positive or negative). This parameter is required.
y Any valid Python number (positive or negative). This parameter is required.
 
Note:
If the x or y parameters are not numbers, the return value will be TypeError.
If the value of parameters x or y is zero, fmod() function returns ValueError.

 

Python fmod() Function Compatibility

Python 2.x – Yes
Python 3.x – Yes

 

Return Value of fmod() Function

The factorial function will return a floating point number value after calculating module of given parameters x and y.

 

Python fmod() Function Example

Output of Python fmod() function:
0.0
2.0
-8.0
-1.0

 
Note that in output all the numbers whether they are negative or positive are converted into a floating point number after calculating module through fmod() in Python programming language.

 

LearnAndLearn.com © 2018 - All rights reserved