Modules and several files
Split a program into files and import them; what the standard library offers without installing anything.
Runs in Zerethon IDE · Python 3.12
Official Python documentation ↗
main.py
from geometry import area
import math
print(area(3, 4))
print(round(math.pi, 3), math.sqrt(16))
geometry.py
def area(width, height):
return width * height
Output
12 3.142 4.0
main.py (the entry, run by Run) and geometry.py next to it.
- A file
geometry.pyis imported asgeometry; a folderutils/withutils/text.pyis imported asutils.text. - The whole standard library is available (
math,random,datetime,collections,itertools,json,re, …). - Third-party packages (
pip install) are not available: runs have no network and nothing is installed during a run.