The Math Module
Python comes with a built-in math module that provides a wide range of mathematical functions. To use it, you first need to import it at the top of your script.
import math

Common Math Functions
Python Math Module Functions
Visualizing Math Functions




Using Math Functions
import math # Square root print(math.sqrt(144)) # 12.0 # Power print(math.pow(3, 4)) # 81.0 # Rounding print(math.floor(7.8)) # 7 print(math.ceil(7.2)) # 8 # Circle area radius = 5 area = math.pi * math.pow(radius, 2) print(round(area, 2)) # 78.54
Remember to import math before using any math module functions. You can also import specific functions using: from math import sqrt, pi

.webp&w=3840&q=75)
.webp&w=3840&q=75)
.webp&w=3840&q=75)
.webp&w=3840&q=75)
.webp&w=3840&q=75)