Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Phase 4 — Intermediate Python, the CLI, and Git

Phase 3 gave you Python’s basic toolkit. Phase 4 gives you the professional toolkit — the way real programmers actually work. Three big additions: the command line (running programs without an editor’s green button), Git (version control for your code), and multi-file programs (because real projects don’t fit in one file).

What this phase is

Nine sessions covering the workflow tools that make programming feel like a job, not a hobby. Lots of new ideas about how to work rather than new Python syntax. By the end, you’ll be running scripts from the terminal, organizing code across multiple files, using Git to save versions of your work, and writing simple tests to verify your code does what you think.

What you’ll learn

SessionIdeaWhat’s new
1The command lineOpen a terminal; cd, ls, python script.py
2Multi-file programsSplitting code; import yourfile; modules
3Standard library modulesos, sys, datetime, pathlib
4A light intro to classesclass, __init__, methods
5Git — saving versionsinit, add, commit, log, diff
6Git in practicerecovering, undoing, light branching
7Testing your codeassert statements; simple test functions
8Milestone project work day 1plan + build (with Git from day one)
9Milestone project work day 2 + demofinish + showcase

The Python concepts here are smaller than Phase 3’s, but the workflow changes are huge. You go from “code in Thonny, click green button” to “code in Thonny, save, run from terminal, commit to Git.” That’s how every professional programmer works.

What you’ll build

Smaller projects throughout, one bigger milestone at the end:

  • Sessions 1-3: small experiments to learn the new tools.
  • Session 4: your first program with a class — maybe a simple BankAccount with deposit/withdraw, or a Pet you feed and play with.
  • Sessions 5-6: a small project tracked in Git from start to finish.
  • Session 7: tests for code you’ve already written.
  • Sessions 8-9: a milestone project of your own design using all the new tools — multi-file, Git-tracked, tested.

What you’ll need

Same machine as Phase 3 — Linux Mint XFCE has a terminal built in (Applications → Terminal Emulator, or right-click the desktop). Git is pre-installed. Thonny still works for editing. Python is still Python.

The only new thing on the machine: you’ll spend more time in the terminal window than ever before.

How sessions work

Same shape as before:

  • Part A introduces a new tool with a guided exercise. Stands alone if class gets cut short.
  • Part B is open practice or a project that uses Part A. Often tiered (base / stretch / extension).
  • Wrap-up to share what you did.

A note about the terminal

The terminal feels weird at first. It’s a black (or white) window where you type commands and the computer responds with text. No buttons, no menus. Just text in, text out.

Almost every professional programmer uses the terminal every day. By the end of Phase 4, it’ll feel normal. Trust the process.

A note about Git

Git is a tool that saves versions of your code. Every time you make a change worth keeping, you commit it. Later, if you break something, you can go back to a previous version. If you have ten files and you want to know what changed yesterday, Git tells you.

Git is the most important tool in modern programming after the language itself. Phase 4 introduces it locally (on your own machine, just for you). Phase 6 introduces GitHub — the website where programmers share Git repositories with each other.

Where to start

Session 1: The command line is where Phase 4 begins. We open a terminal and learn how to run Python from it.

When you’re stuck, the Getting unstuck appendix has the checklist. The Glossary will grow as Phase 4 introduces new terms.

Welcome to professional tooling. Let’s go.