math is a Python built-in module which means it comes together with the python package and you do not need to install it separately. In the following examples let us create various little programs to use the math module to solve some problems.
In order to use the math module, you need to import it into the Python file.
import math
Find the square root of 32.
math.sqrt(32) #5.656854249492381
Find the degree of pi.
math.degrees(math.pi) # 180 degrees
Find the sin of 45.
math.sin(45) # 0.8509035245341184
Find the cos of 45.
math.cos(45) # 0.5253219888177297
Find the tan of 45.
math.tan(45) # 1.6197751905438615
Find log 10 of 13.
math.log(13,10) # 1.1139433523068367
Find the exponential of 13.
math.exp(13) # 442413.3920089205
Truncate the decimal part of 3.78.
math.trunc(3.78) # 3
Get the ceiling value of 3.78.
math.ceil(3.78) # 4
Get the floor value of 3.78.
math.floor(3.78) # 3
Get the pi value.
math.pi # 3.141592653589793
Get the exponential value.
math.e # 2.718281828459045
Find the hypotenuse of the triangle with x = 3, y = 4.
math.hypot(3,4) # 5
That is it, there are lots more other methods of the math module that awaiting you to explore thus it is your turn to try them out!