How to make a sequence PREMIUM

Trey Hunner smiling in a t-shirt against a yellow wall
Trey Hunner
7 min. read 4 min. video Python 3.8—3.12

How can you make a sequence in Python?

What is a sequence in Python?

Sequences in Python are objects that can be looped over, can be indexed and have a length:

So to make our own sequences, we need to make a class with instances that are iterable, indexable, and work with the built-in len function:

...

A Python Tip Every Week

Need to fill-in gaps in your Python skills? I send weekly emails designed to do just that.