Running Python
Three ways to run Python code — and when to use each.
There are three everyday ways to run Python. You will use all three.
1. The REPL — instant experiments
Open a terminal and type python3 (Windows often accepts python). You will see
the >>> prompt: the REPL (Read–Evaluate–Print–Loop). You type one expression;
Python immediately evaluates it and shows the result:
>>> 2 + 3
5
>>> "py" * 3
'pypypy'
The REPL is a calculator on steroids and your first debugging tool — use it to test a tiny idea before putting it in a program.
2. Script files — real programs
Save your instructions in a file ending in .py, then run the whole file:
python3 hello.py
Scripts run from top to bottom. Files are how real programs live; every challenge in this course is one file you write and run.
3. From inside other programs
Python also runs inside this course's code editor. When you press Run here, your code is executed in a sandbox and the tests are checked. Same idea, safer place.
The editor in this course grades functions, return values, and printed output — challenges never need you to type input while they run. You will build interactive programs locally and test them in your own terminal.