Set up your courses
Pick the courses you're taking and this page shows only those. About 30 seconds.
Code, one block at a time.
Short lessons: predict first, try it in a model, then see why it works.
Start the first lessonNo sign-up. Your progress saves on this device, and you can keep it later with an email.
Know some python already?
Answer about 10 questions and skip the units you know. New to it? Start with the first lesson below.
Values, types and arithmetic
Say exactly what a line of Python prints, work out arithmetic with Python's precedence and its three divisions, name the type of every value, and read the last line of an error message.
Formulas: Values, types and arithmeticVariables, assignment and input
Store values under names, trace assignments, updates and swaps line by line, and write programs that read a number, compute with it and print the result.
Strings and f-strings
Pick characters and slices out of strings, transform text with methods that return new strings, compare text, and print values in exact layouts with f-strings.
Decisions
Ask questions with comparisons, choose which lines run with if, else and elif, combine conditions with and, or and not, and compare floats safely.
While loops
Repeat lines while a condition holds, keep counters and running totals, read input until a stop value, leave or skip with break and continue, and catch loops that never end or run once too often.
For loops and range
Walk through strings and lists with for, count with range, add up and count over a range, choose between for and while, and print tables with nested loops and f-strings.
Functions
Define and call functions, pass arguments, return values instead of printing them, keep names local, use defaults and keyword arguments, and split a task into small tested functions.
Lists
Make, index and slice lists, change them in place, loop over them, tell methods that return None from functions that return a new list, copy lists instead of aliasing them, pass them to functions, build them with loops and comprehensions, and store tables as lists of rows.
Dictionaries, tuples and sets
Pack and unpack tuples, look values up by key, count with a dictionary and report in sorted order, use sets for membership and uniqueness, and choose the right structure for a job.
Patterns that solve problems
Recognize and write the standard loop plans (accumulate, count, filter, search, best so far, transform), combine them in one program, and guard their edge cases.
Errors, debugging and testing
Read tracebacks, name the common errors, find logic errors by tracing and by testing a guess, handle and raise exceptions, and test functions with assert and well-chosen cases.
Numerical problems for engineers
Print conversion tables, compute running averages and standard deviations, stop float loops safely, find roots by bisection and Newton's method, simulate with Euler steps and seeded random numbers, and chain it all into a data pipeline.