What an import line means
P39.reading-code.02 · Audience: guest, language-pro, it-ml · Prerequisites: What a rung is, versus a notebook
Open almost any Python file — including the ones in every other discipline here
— and the first line is import something. It looks like a password you were
never given. It is not. This module demystifies the one line that starts
everything else.
ⓘ Concept: import borrows a ready-made tool
import means "borrow a tool someone else already wrote,
so I don't have to build it myself". Python ships with ready-made
toolboxes; an import line opens one. After import math you can use
its tools by writing math. and the tool's name — for example
math.sqrt(9) for a square root. You are not memorising magic; you
are borrowing.
Why it matters — The import line is the single most common thing a beginner sees and cannot explain. Naming it removes the feeling that code is written in a secret language.
The everyday comparison
You do not forge your own scissors before cutting paper — you take a pair from
the drawer. import is opening the drawer. math is one drawer that comes with
Python; there are many others, and later you will borrow tools for dates, for
text, for tables. The line that once looked cryptic just says "pass me that
tool".
Your turn
The rung opens the math toolbox and uses math.sqrt. You will let that
borrowed tool work out a square root for you — no arithmetic by hand — and say,
in plain words, what an import line actually does.
Ask the mentor about this module
Ask a question about this content. The mentor explains and grounds its answer in what you are studying; asking is recorded as a learning signal, not a grade.
🎓 Practice ladder
1 graded rung · ~4 minOne short rung. Use the borrowed tool, answer one plain question, press Run. This is the last step of the "you are not lost" pillar.
Explorer rung — borrow a tool with import
Loading exercise…
Where next?
Go up a level