Python Exercise Paths

Want to work through exercises focused on a specific topic? Start an exercise path!

After selecting an exercise path, you'll receive recommendations for exercises in that path. Once you've worked through a path, you'll continue receiving exercises from your skill level (the level).

You can always change the path you're in or deactivate your activate path later.

Intro to Generators and Iterators

You'll start with a few exercises that could be iterator/generator-powered, but don't necessarily need to be.

This path mostly focuses on getting generator function and generator expression practice, but you'll probably need to write at least one iterator class along the way as well.

This path is recommended for novice-level users or intermediate-level users who are new to generators.

Exercises included
with_previous
uniques_only
lstrip
RandomLooper
chunked
loop_tracker
strict_zip
Loading...
Introduction to CLIs and file manipulation

In this path you'll get practice making command-line interfaces, processing text files, and working with the standard input and standard output file streams.

If you've never processed text files before or made command-line interfaces, this path may be a challenge, but it's one you'll want to start with.

Exercises included
unsmart.py
phonetic.py
tee.py
passphrase
Loading...
Diving Into Classes

This is an fast-paced introduction to classes for advanced beginners.

In this path you'll practice working with methods, instance attributes, class-level attributes, properties, inheritance, string representations, comparison operators, data classes, and a couple dunder methods you probably haven't thought to create before.

This path is recommended for novice-to-intermediate users who have some experience with Python classes already and want to practice their skills.

Exercises included
Circle
Point
Month
NextDate
float_range
BankAccount
Loading...
Introduction to first-class functions and decorators

This path will introduce you to the notion of first-class functions and eventually to decorator functions.

The first exercise involves passing functions as arguments. The next exercise involves defining a function within another function. After that you'll receive 2 exercises that require making your own decorators.

This path is recommended for novice-level users

Exercises included
natural_sort
partial
count_calls
coalesce
Loading...
Deeper Into Classes (with dunder methods)

In this path you'll get practice with operator overloading and inheritance.

You'll make classes that act as iterables, mappings, and sequences and you'll also make a class mixin (for use with multiple inheritance).

You'll need to take the "Diving Into Classes" path before this one.

Exercises included
EasyDict
Unpacker
FieldTracker
ProxyDict
Circle (revisited)
ReverseView
Loading...
Context Managers

This path will introduce you to defining and using context managers.

This path is recommended for intermediate-level users.

Exercises included
suppress
make_file
cd
Timer
warningutils
Loading...
Intermediate CLIs and file manipulation

This path includes practice with file encodings and processing binary data files.

The "Introduction to CLIs and file manipulation" path is recommended before this one.

Exercises included
iconv.py
grep
checksum
gz
Loading...
Custom Collection Practice

Get practice making dictionary-like, set-like, and list-like classes.

In these exercises you'll make more of these custom collections than you'll likely ever need to write in your own code.

Do the "Deeper into Classes" path before this one (one of the exercises in that path is a prerequisite for that's in this one).

Exercises included
PermaDict
CyclicList
SequenceZip
Grouper
OrderedSet
OrderedSet (revisited)
ProxyDict (revisited)
Loading...
Intro to Descriptors

These 2 exercises should give you a taste for what descriptors are and how they work.

You probably won't ever need to create descriptors yourself in Python, but it's nice to know about them (classmethod, staticmethod, property, and the method calling syntax in Python are all descriptor-powered).

Exercises included
alias
class_property
Loading...
Advanced CLIs and file processing

This path is for you if you've made command-line interfaces, you how to navigate the file system, and you've worked with binary data files before, but you just want more practice with it all.

The "More CLIs and file manipulation" path is recommended before this one.

Exercises included
format_fixed_width
last_lines
find_duplicates
count_lines
lines2.py
dups.py
crossword helper
split
Loading...
Time Complexity Practice

The 3 exercises in this path all involve considering the time complexities involved with the data structures you're using.

Should you use a list, a set, a dictionary, or some combination of the three? And are there any tools in the standard library to help you accomplish your goal in a time-efficient way?

Exercises included
MinHeap
SortedList
OrderedDict
Loading...
Even More Descriptors

Want more descriptor practice than you'll ever need? Work through the Intro to Descriptors path and then do this one.

The 3 exercises here go deeper into descriptors than you'll likely ever need to go. You'll also get a bit of practice with attribute lookups, memory management (important in descriptor land sometimes), and inheritance.

Exercises included
validators
cached_property
computed_property
Loading...
Intro to Metaclasses

Want to learn about metaclasses by making your own? Try these 2 exercises out. These exercises aren't easy, but it's hard to find a realistic metaclass example that is easy.

If you don't know what metaclasses are, you probably don't need to know what they are. Unless you're implementing a framework for other people to write code with (like Django) you probably shouldn't even use this magic in your own code.

Exercises included
final_class
NoMethodCollisions
Loading...
Python 3.10 (Advanced)

This exercises involve could benefit from Python 3.10 features (namely features I mentioned in my article on Python 3.10).

All of these exercises are somewhat advanced, so I don't recommend this exercise path for novice users.

Exercises included
CyclicList
Vector
SortedList
Loading...
Comprehension Practice

Want some practice with list comprehensions? These 6 exercises should help.

Exercises included
interleave
add
parse_ranges
format_fixed_width
chunked
reprtools
Loading...