Python programming
Taught in this order — content/code/python-basics/course.yaml — the /code course's own lesson order
1Basics weeks 1–3 Start unit ›
00 Run it! Start ›
Syllabus for this subtopic 3 points
- Run, Check answer, the hint and Reset — what each button does
- Where a program's output appears
- Changing one thing at a time, and why nothing here can break
01 Your first program Start ›
Syllabus for this subtopic 4 points
- How a program runs: you write it, the computer follows it line by line
- print() and what goes inside the brackets
- Strings: quotation marks make text
- Comments, and the mistakes beginners hit first
02 Variables Start ›
Syllabus for this subtopic 4 points
- A variable is a named box that holds a value
- name = value stores; the right side is worked out first
- Changing a variable, including score = score + 1
- Naming rules, case sensitivity, and NameError
03 Numbers & operators Start ›
Syllabus for this subtopic 4 points
- Integers and floats, and why / always gives a float
- Floor division //, remainder %, and power **
- Splitting a quantity into units with // and %
- Order of operations, and using brackets to say what you mean
04 Getting input Start ›
Syllabus for this subtopic 4 points
- input() asks the person running the program for a value
- input() always hands back a string, whatever was typed
- int() and float() turn that text into a number
- Input → process → output, the shape of almost every program
05 Working with strings Start ›
Syllabus for this subtopic 4 points
- A string is a sequence; every character has an index counting from 0
- A slice s[a:b] takes from a up to but not including b
- len(), .upper(), .lower() — a method returns a NEW string
- f-strings put a value inside a piece of text
p1 Project: Mad Libs
Coming soon
2Decisions and loops weeks 4–6 Start unit ›
06 Making decisions Start ›
Syllabus for this subtopic 4 points
- if runs a block only when a condition is True
- The colon and the indent are what mark the block
- Comparison operators, and == is not =
- elif and else; and, or, not to combine tests
07 Counting loops Start ›
Syllabus for this subtopic 4 points
- A for loop repeats a block once per item
- range(a, b, step) stops before b
- The accumulator pattern: start at 0 outside the loop, add inside
- Tracing a loop pass by pass
08 While loops Start ›
Syllabus for this subtopic 4 points
- A while loop repeats while a condition stays True
- Something inside the loop must change, or it never ends
- Choosing for or while: known count, or a condition
- break leaves the loop; continue skips to the next pass
p2 Project: Guess the number
Coming soon
3Data and functions weeks 7–10 Start unit ›
09 Lists (1-D arrays) Start ›
Syllabus for this subtopic 4 points
- A list holds many values under one name, indexed from 0
- append, insert, pop and remove change the list in place
- Looping over a list, by item and by index
- The running-best pattern: sum, count, largest
p3 Project: Quiz with a score
Coming soon
10 Functions Start ›
Syllabus for this subtopic 4 points
- def names a block you can run from anywhere
- Parameters take values in; return sends one value back
- return is not print — a printed value cannot be used again
- A function ends the moment it returns
p4 Project: Rock, paper, scissors
Coming soon
11 Scope & arguments Start ›
Syllabus for this subtopic 4 points
- A name made inside a function is local and disappears on return
- Reading a global is allowed; rebinding one needs global
- Default parameter values, and why a mutable default is a trap
- Numbers and strings are copied in; lists are shared
12 Dictionaries (records) Start ›
Syllabus for this subtopic 4 points
- A dictionary looks a value up by key, not by position
- Read, change and add with d[key]; keys are unique
- A dictionary as one record, a list of them as a table
- Looping over keys, values and items; counting with a dictionary
p5 Project: Text adventure
Coming soon
4Writing whole programs weeks 11–13 Start unit ›
13 Planning & pseudocode Start ›
Syllabus for this subtopic 4 points
- Decomposition and abstraction: break it up, leave detail out
- Flowcharts and their four standard shapes
- Sequence, selection and repetition — the three building blocks
- Pseudocode: the steps in order, before any real code
14 Errors & testing Start ›
Syllabus for this subtopic 4 points
- Syntax, runtime and logic errors, and how each shows itself
- Reading a traceback from the bottom up
- Test data: normal, boundary and erroneous
- Dry running and tracing to find a logic error
15 Putting it all together Start ›
Syllabus for this subtopic 4 points
- Building a program out of small functions, one answer each
- Built-in helpers: len, sum, max, min, round, sorted
- The counting pattern with a condition inside the loop
- Testing each function on its own before joining them up
p6 Project: Hangman
Coming soon