math Module

say it: “MATH MOJ-ool” /mæθ ˈmɒdʒuːl/

A standard module with square roots, pi and other math tools.

What is the math module?

The math module has everyday math tools like square roots, rounding up or down, and pi.

import math
print(math.sqrt(16))   # 4.0
print(math.ceil(2.1))  # 3 (round up)
print(math.pi)         # 3.141592653589793

Level: Apprentice · More Python terms at this level

Updated