Python | fmod() function Last Updated : 20 Feb, 2023 Comments Improve Suggest changes Like Article Like Report fmod() function is one of the Standard math library function in Python, which is used to calculate the Module of the specified given arguments. Syntax: math.fmod( x, y ) Parameters: x any valid number (positive or negative). y any valid number(positive or negative). Returns: Return a floating point number value after calculating module of given parameters x and y. Time Complexity: O(1) Auxiliary Space: O(1) Example #1: Python3 # Python3 program to demonstrate fmod() function import math # Tuple Declaration Tup = (15, 22, -2, -40 ) # List Declaration Lis = [-89, 38, -39, 16] # modulus of +ve integer number print(math.fmod(4, 5)) print(math.fmod(43.50, 4.5)) # modulus of -ve integer number print(math.fmod(-17, 5)) print('%.2f' %math.fmod(-10, 4.78)) # modulus of tuple item print("\nModulus of tuple items:") print(math.fmod(Tup[2], 5)) print(math.fmod(Tup[2], -6)) # modulus of list item print("\nModulus of list items:") print(math.fmod(Lis[3], 4)) print(math.fmod(Lis[0], -15)) Output: 4.0 3.0 -2.0 -0.44 Modulus of tuple items: -2.0 -2.0 Modulus of list items: 0.0 -14.0 Example #2: ValueError and TypeError If both the x and y arguments are Zero, fmod() function will return the output as ValueError.If y argument (second argument) is Zero, fmod() function will return the output as ValueError.If the x value or y value is not a number, fmod() function will return TypeError. Python3 # Python3 program to demonstrate # errors in fmod() function import math # will give ValueError print(math.fmod(0, 0)) print(math.fmod(2, 0)) # it will give TypeError print(math.fmod('2', 3)) Output: ValueError: math domain error ValueError: math domain error TypeError: a float is required Comment More infoAdvertise with us Next Article Python | fmod() function jana_sayantan Follow Improve Article Tags : Python Python-Library Python-Built-in-functions Python math-library Python math-library-functions +1 More Practice Tags : python Similar Reads Python | fsum() function fsum() is inbuilt function in Python, used to find sum between some range or an iterable. To use this function we need to import the math library. Syntax : maths.fsum( iterable ) Parameter : iterable : Here we pass some value which is iterable like arrays, list. Use : fsum() is used to find the sum 1 min read cmp() function - Python cmp() method in Python 2.x compares two integers and returns -1, 0, 1 according to comparison. cmp() does not work in python 3.x. You might want to see list comparison in Python.ExamplePython# Example 1 print(cmp(3, 4)) # Example 2 print(cmp(5, 5)) # Example 3 print(cmp(7, 6)) Output-101ExplanationI 3 min read Python Functions Python Functions is a block of statements that return the specific task. The idea is to put some commonly or repeatedly done tasks together and make a function so that instead of writing the same code again and again for different inputs, we can do the function calls to reuse code contained in it ov 11 min read Python | frexp() Function frexp() function is one of the Standard math Library function in Python. It returns mantissa and exponent as a pair (m, e) of a given value x, where mantissa m is a floating point number and e exponent is an integer value. m is a float and e is an integer such that x == m * 2**e exactly. If x is zer 2 min read dir() function in Python The dir() function is a built-in Python tool used to list the attributes (like methods, variables, etc.) of an object. It helps inspect modules, classes, functions, and even user-defined objects during development and debugging.Syntaxdir([object])Parameters: object (optional): Any Python object (lik 3 min read numpy.finfo() function â Python numpy.finfo() function shows machine limits for floating point types. Syntax : numpy.finfo(dtype) Parameters : dtype : [float, dtype, or instance] Kind of floating point data-type about which to get information. Return : Machine parameters for floating point types. Code #1 : Python3 # Python program 1 min read pow() Function - Python pow() function in Python is a built-in tool that calculates one number raised to the power of another. It also has an optional third part that gives the remainder when dividing the result. Example:Pythonprint(pow(3,2))Output9 Explanation: pow(3, 2) calculates 32 = 9, where the base is positive and t 2 min read Python | math.fabs() function In Python, math module contains a number of mathematical operations, which can be performed with ease using the module. math.fabs() function returns the absolute value of the number. Syntax: math.fabs(x) Parameter: x: This is a numeric expression. Returns: the absolute value of the number. Time Comp 1 min read modf() function - Python modf() function is an inbuilt function in Python that returns the fractional and integer parts of the number in a two-item tuple. Both parts have the same sign as the number. The integer part is returned as a float. Example:Pythonimport math # modf() function used with a positive number print("math. 3 min read Python seek() function The concept of file handling is used to preserve the data or information generated after running the program. Like other programming languages like C, C++, Java, Python also support file handling. Refer the below article to understand the basics of File Handling.  File Handling in Python.  Reading 2 min read Like