Sequences

Learn about sequences and their different types in this lesson.

What are sequences?

A sequence is an ordered collection of items that allows random access. Examples of sequences include lists, strings, and tuples. You should already be familiar with these, but here is how they relate to iterators:

Ordered means that each item in the sequence has an index, starting at 0.

Random-access means we can directly access item index i in the sequence using square bracket notation, as shown here:

Get hands-on with 1200+ tech skills courses.