Python Lists and Indexing from Zero, Explained

A row of things, and how to pick out one item at a time.

  • Lesson 1 of 5
  • PRO
  • Ages 10+
  • 4 hands-on levels
See what PRO unlocksA one-time $49.99 purchase. Topics 1–3 are free.

The dragon explains

Lists and indexing

  1. The dragon: A list holds several things in ONE box, in order. Square brackets, commas between items.

  2. The dragon: hoard = ["gold", "gems", "a sword"] makes a list of three things. To get ONE item back, use its INDEX.

    example.pyPython 3
    hoard = ["gold", "gems", "a sword"]print(hoard[0])
    Outputgold
  3. The dragon: Same rule as range(): the FIRST item is index 0, not 1. hoard[1] is the SECOND item.

    example.pyPython 3
    hoard = ["gold", "gems", "a sword"]print(hoard[1])
    Outputgems
  4. The dragon: Negative indexes count from the END. hoard[-1] is always the LAST item, whatever the list's length.

    example.pyPython 3
    hoard = ["gold", "gems", "a sword"]print(hoard[-1])
    Outputa sword
  5. The dragon: Watch the boundary: a 3-item list has valid indexes 0, 1, 2 — never 3. Asking for hoard[3] is one too far.

Quick check

Check your understanding

Say your answer out loud before reading the marked one. Every wrong option is a mistake real beginners make.

  1. Question 1 of 2

    party = ["Ember", "Blaze", "Frost"]. What does party[1] give you?

    question.pyPython 3
    party = ["Ember", "Blaze", "Frost"]print(party[1])
    • BlazeCorrect
    • Ember
    • Frost

    Why: Indexing starts at 0: party[0] is Ember, party[1] is Blaze, party[2] is Frost. The index is always one less than the item's position when you count normally.

  2. Question 2 of 2

    party has 5 names. Which index ALWAYS gets the last one, no matter how many names are in the list?

    • party[-1]Correct
    • party[5]
    • party[4]

    Why: party[-1] always means the last item, regardless of length — that's the whole point of negative indexing. party[4] happens to also work for a 5-item list specifically, but breaks the moment the list's length changes.

In the game

What you'll practice

Four levels in the game: one guided first try with the shape of the answer already there, then three to solve on your own.

  1. 1

    GuidedYour first try

    The dragon's hoard is a list: ["gold", "gems", "a sword"]. Print the FIRST item — remember, the first item is index 0, not 1.

  2. +3

    PracticeThree more, on your own

This lesson is part of PRO.

PRO is a one-time $49.99 purchase, no subscription, and unlocks this whole topic along with everything else. Topics 1–3 are free, start to finish.

Unlock this lesson with PRO

Stuck three times? The game offers the answer — unasked.