Skip to content
Skip to resources
peazit

What do you want to understand today?

PEAZIT Aha card

Lists: the first item has index zero

Go straight to resources ↓

A list stores ordered items. An index is a position counted from zero, not the item’s value. len gives the item count; append adds one item to the end.

Lists: the first item has index zero
ObservationWhat it means
a = [10, 20, 30]indices 0, 1, 2
len(a) = 3last nonnegative index is 2

One worked example

  1. a = [4, 8]Two items have indices 0 and 1.
  2. a.append(12)Add a third item.
  3. a[2]Index 2 returns the third item, which is 12.

Watch out: A list of length n has nonnegative indices from 0 to n−1. Python also supports negative indices; −1 means the last item.

Goal, prerequisites and card origin

What you will learn: Find an item by index and identify list length.

What you need first: Variables and integers.

An original PEAZIT working card. Independent expert review and effectiveness testing have not yet taken place. · v1

Reference for the underlying principle ↗
Show connections

A list stores ordered items. An index is a position counted from zero, not the item’s value. len gives the item count; append adds one item to the end.

Other options for this topic

Catalogue

Nothing here just yet.

Try a shorter search, another language or fewer filters.

Clear filters

Find your own way. Resources open directly on their authors’ websites. Order reflects search relevance, not a teaching-quality rating.

47,636 resources to explore

15 independent sources

3 resource languages

EXPLORE / EN

Where will curiosity take you?

Start with a subject. Then find your way.

All topics
peazit

Everyone learns differently. Find your way.

Saved

For your next aha.

Your saved links stay in this browser.