← All 101s
PYTHON · 101

Python 101

Free

How Python turns plain English looking syntax into running programs.

25 topics·7 sections·Animations included

Foundations

4 topics
PYVARS
Variables and Types
How Python names values and what built-in types you start with.
3 sectionsRead →
OPERATORS
Operators and Expressions
Arithmetic, comparison, and logical operators, plus how they combine.
2 sectionsRead →
STRINGS
Strings
Text as a sequence of characters, and the methods you reach for daily.
3 sectionsRead →
PYIO
Input and Output
Talking to the user with print and input, and how a script actually runs.
2 sectionsRead →

Control Flow

3 topics
BRANCHING
Conditionals
Choosing which branch of code to run.
2 sectionsRead →
LOOPS
Loops
Doing things repeatedly with for and while.
3 sectionsRead →
ERRORS
Exceptions
What happens when things go wrong, and how to recover.
3 sectionsRead →

Data Structures

4 topics
LISTS
Lists
Ordered, mutable sequences, the everyday container.
3 sectionsRead →
TUPLES
Tuples
Immutable, fixed shape records.
2 sectionsRead →
DICTS
Dictionaries
Key value mappings, the workhorse of Python.
3 sectionsRead →
SETS
Sets
Unordered collections of unique elements.
2 sectionsRead →

Functions

4 topics
FUNCTIONS
Defining Functions
Wrapping a chunk of behavior behind a name.
2 sectionsRead →
ARGUMENTS
Arguments
All the ways to pass values into a function.
3 sectionsRead →
SCOPE
Scope and Closures
Where names live and how nested functions remember them.
2 sectionsRead →
HIGHERORDER
Higher Order Functions
Treating functions as values you can pass around.
2 sectionsRead →

Classes and OOP

4 topics
CLASSES
Classes and Instances
Bundling state and behavior into a custom type.
3 sectionsRead →
INHERITANCE
Inheritance
Building new classes on top of existing ones.
2 sectionsRead →
DUNDERS
Dunder Methods
Special methods that hook into Python syntax.
2 sectionsRead →
ENCAPSULATION
Properties and Encapsulation
Controlling how attributes are read and written.
2 sectionsRead →

Idiomatic Python

4 topics
COMPREHENSIONS
Comprehensions
Building collections inline from an expression and a loop.
2 sectionsRead →
ITERATORS
Iterators and Generators
How for loops work under the hood, and how to write your own.
3 sectionsRead →
DECORATORS
Decorators
Modifying a function by wrapping another function around it.
3 sectionsRead →
CONTEXTS
Context Managers
Guaranteeing cleanup with the with statement.
2 sectionsRead →

Modules and Files

2 topics
MODULES
Modules and Imports
Break code into multiple files and reuse what others have written.
3 sectionsRead →
FILES
File I/O
Read from and write to files on disk.
3 sectionsRead →