Python math Module

FunctionDescriptionExample
math.ceil(x)Returns the smallest integer greater than or equal to x.math.ceil(4.3) returns 5
math.floor(x)Returns the largest integer less than or equal to x.math.floor(4.8) returns 4
math.sqrt(x)Returns the square root of x.math.sqrt(25) returns 5.0
math.pow(x, y)Returns x raised to the power y.math.pow(2, 3) returns 8.0
math.exp(x)Returns e (Euler’s number) raised to the power x.math.exp(2) returns 7.38905609893065
math.log(x)Returns the natural logarithm of x.math.log(10) returns 2.302585092994046
math.sin(x)Returns the sine of x in radians.math.sin(math.pi/2) returns 1.0
math.cos(x)Returns the cosine of x in radians.math.cos(0) returns 1.0
math.tan(x)Returns the tangent of x in radians.math.tan(math.pi/4) returns 1.0
math.degrees(x)Converts angle x from radians to degrees.math.degrees(math.pi) returns 180.0
math.radians(x)Converts angle x from degrees to radians.math.radians(180) returns 3.141592653589793
math.piA constant representing the mathematical constant π (pi).math.pi returns 3.141592653589793
math.eA constant representing the mathematical constant e (Euler’s number).math.e returns 2.718281828459045