Why Python — and how to run it
Python is the most-taught first language in the world, the default for AI and data, and one of the top three languages in every hiring survey. This lesson gets you oriented — what Python is good at, and how to actually run it — before you write a line of it.
Why Python won
Python optimizes for the reader, not the machine. Code looks close to English, indentation is the structure (no curly braces), and one obvious way to do things is a design goal. That readability compounds: you spend far more time reading code than writing it.
| Python is excellent for | Python is a poor fit for |
|---|---|
| AI/ML, data science, scripting, automation | Ultra-low-latency systems (games, HFT) |
| Backend APIs, glue code, prototyping | On-device mobile apps |
| Teaching programming concepts | CPU-bound work needing raw speed (without C extensions) |
The trade-off: Python is interpreted and dynamically typed, so it runs slower than C or Rust and catches some errors only at runtime. In practice, the heavy lifting (NumPy, PyTorch) is C under the hood, and developer speed usually matters more than execution speed.
The mental model
Unlike C++ or Java, there's no separate "build" step. You hand a text file to the python interpreter and it runs it top to bottom. This is why Python feels fast to iterate in.
Getting Python on your machine
- Check first — many systems ship it. In a terminal:
python3 --version. Anything 3.10+ is fine for this course. - Install — download from [python.org](https://python.org) (Windows/macOS), or use your package manager. On Windows, tick "Add Python to PATH" during install.
- Editor — install [VS Code](https://code.visualstudio.com) + the Python extension. It's free and the industry standard.
Python 2 is dead — it reached end-of-life in 2020. If a tutorial uses print "hello" (no parentheses), it's ancient. We use Python 3 exclusively.
Two ways to run code
- 1The REPL — type
python3(orpython) with no file. You get a>>>prompt where each line runs instantly. Perfect for experimenting. - 2A script — save code in
hello.py, runpython3 hello.py. This is how real programs ship.
# hello.py — your first program
print("Hello, Python!")$ python3 hello.py
Hello, Python!That print(...) is a function call: the name, then parentheses holding the argument. You'll make thousands of these. Next lesson: the values that go inside them.