Un module ajoute des outils qui ne sont pas automatiquement disponibles.
import math
print(math.pi)
print(math.sqrt(25))import math
rayon = 3
aire = math.pi * rayon ** 2
print(aire)
from math import pi, sqrt
print(pi)
print(sqrt(81))
| Fonction | Exemple | Résultat |
|---|---|---|
abs(x) | abs(-7) | 7 |
round(x, n) | round(3.14159, 2) | 3.14 |
len(liste) | len([8, 3, 5]) | 3 |
int(x) | int("12") | 12 |
float(x) | float("4.5") | 4.5 |
x = -12
print(abs(x))