01Import a module
main.py
import math
print(math.sqrt(16))
print(math.floor(3.7))Output
4.0 3
Python modules and imports: import standard library modules, use from imports, create aliases, and work with math and random.
Run any example below with one click, or write your own in the Python playground.
import math
print(math.sqrt(16))
print(math.floor(3.7))4.0 3
from math import pi, sqrt
print(round(pi, 4))
print(sqrt(25))3.1416 5.0
import math as m
print(m.pow(2, 10))1024.0
import random
random.seed(42)
print(round(random.random(), 4))0.6394