01 / GETTING STARTED · LESSON 01

Your first Python program

Run a small program and use an error message to find a mistake.

8 min · learn at your pace

A program is a set of instructions

Python reads your script from top to bottom. print() is a function: it performs a job using the values inside its parentheses. Text belongs inside matching quotes. A line beginning with # is a comment for people reading the code.

The editor holds main.py. Run code executes it in a real Python interpreter inside your browser. You can also type a short command at the >>> prompt. Variables and files stay available between runs. Reading a lesson never needs the runtime to load.

Errors are useful information

The starter contains a missing quote. Python reports a SyntaxError before running the program. Read the last line of an error first, then look at its file and line number. Fix one issue and run again. A traceback is a route back to the problem, not a judgement of your ability.

Check answer starts a fresh lab and tests the result. It accepts equivalent programs. The terminal displays text; automatic checks inspect values and files too. Your draft and completed file changes save in this browser. Download your script if you want a separate copy.

Try an example.py
print("Hello, Python!")
print("One small step.")
YOUR TURN

Put it into practice.

Fix the starter, then print two lines: Inventory started and Checked 3 devices, in that order.

See an explained solution
One way to solve it.py
print("Inventory started")
print("Checked 3 devices")

Each print call writes one line. Matching quotes tell Python where the text ends; parentheses tell it where the function call ends.