MemotivaSequences and slicing

What does negative indexing mean?

Sequences and slicing

Audio flashcard · 0:13

Nortren·

What does negative indexing mean?

0:13

Negative indices count from the end of the sequence backward. Index negative one is the last element, negative two the second to last, and so on. Negative indices work in slicing too, allowing you to express slices relative to the end without computing the length.
docs.python.org