Python math Module


Python provides a module full of useful math functions. The documentation is at https://docs.python.org/3/library/math.html.

Below is some example code I ran in Jupyter Notebook.

print(math.sqrt(5))
print(math.pi)
print(math.factorial(int(5.0))) # must be an integer otherwise error)
print(math.factorial(math.floor(5.6)))
2.23606797749979
3.141592653589793
120
120

Leave a Reply