Master Python
Start from never having written a line of code and finish able to build a program, read somebody else's, and know which of the two you should be doing.
Contents
Python from the first line to code other people can read. Values and names, talking to the person using the program, decisions and loops, the four collections, functions, text, errors, files, the standard library, classes, comprehensions and generators, and the habits that keep a program working after you have forgotten how it does.
First steps
What a program actually is, how to make one say something back to you, and what happens when you get it wrong. By the end you will have run and changed three dozen small programs, read your first error messages without flinching, and written four small pieces of working Python.
- 7 min
What a program actually is
A list of instructions, followed in order by something extremely fast and extremely literal.
- 7 min
Your first line of Python
print, and the four separate things happening inside one very short line.
- 6 min
One line at a time, top to bottom
How a program with several instructions in it is actually read.
- 6 min
Text and numbers are different things
Why quotation marks change what something is, and the arithmetic you get for free.
- 6 min
Words and numbers on the same line
Printing several things at once, joining text end to end, and what happens when the two are mixed.
- 8 min
Putting a value inside a sentence
Writing a sentence with a hole in it, and letting Python fill the hole in.
- 5 min
Notes to yourself in the program
The hash mark, why it exists, and the trick of switching a line off.
- 7 min
Your first error, on purpose
What the machine does when it cannot follow you, and why that is good news.
- 9 min
The four errors you will meet first
SyntaxError, IndentationError, NameError and TypeError, each shown broken so you can fix it.
- 7 min
Writing your first function
A small machine with a name: something goes in, something comes back.
- 6 min
print and return are not the same thing
The difference that trips almost everybody up once, and how the problems at the end of a section are marked.
- Easy
Name badge
Coding problem · Strings, Functions
- Easy
Change from the till
Coding problem · Numbers, Functions
- Easy
Tickets left
Coding problem · Strings, f-strings
- Medium
Length of a video
Coding problem · Numbers, f-strings
Section quiz
Values and variables
Opens once you finish First steps, including its quiz.
Talking to the person using it
Opens once you finish Values and variables, including its quiz.
Making decisions
Opens once you finish Talking to the person using it, including its quiz.
Repeating things
Opens once you finish Making decisions, including its quiz.
Lists
Opens once you finish Repeating things, including its quiz.
Dictionaries, sets and tuples
Opens once you finish Lists, including its quiz.
Functions
Opens once you finish Dictionaries, sets and tuples, including its quiz.
Working with text
Opens once you finish Functions, including its quiz.
When it goes wrong
Opens once you finish Working with text, including its quiz.
Files and data
Opens once you finish When it goes wrong, including its quiz.
Modules and the standard library
Opens once you finish Files and data, including its quiz.
Classes and objects
Opens once you finish Modules and the standard library, including its quiz.
Comprehensions and generators
Opens once you finish Classes and objects, including its quiz.
Writing Python other people can read
Opens once you finish Comprehensions and generators, including its quiz.
Master Python unit exam
Opens once every section is finished and every quiz is passed.