Member-only story
Top 10 math functions in python
3 min readMay 27, 2021
The math module provides us various functions. Some of them are discussed in this article. Import the math function to begin.
import math
The ten methods in this article are
- ceil and floor
- factorial
- gcd
- sqrt
- pow
- sin, cos, tan
- exp
- fabs
- isclose
- constants
Ceil and floor functions
The ceil() method returns an integer that is greater than or equal to the given float value. Similarly, the floor() method returns an integer that is lesser or equal to the given float value. If an integer value is given the same value is returned.
factorial
This method returns the factorial value of a number. In mathematics, the factorial of a positive integer n, denoted by n! is the product of all positive integers less than or equal to n.
Example 4! is 4*3*2*1 and 5! is 5*4*3*2*1