CurriculumThe Dragon's Inventory

Python Lists, Indexing and Slicing for Kids

A list holds several values under one name, in order, so a program can work with a whole collection instead of one thing at a time.

16 exercises5 lessonsAges 10+PRO
See what PRO unlocks →

What this topic covers

Lists bring back counting from zero, and this time it bites harder: the first item is at index 0, so the last item of a five-item list is at index 4, and asking for index 5 is an error rather than a wrong answer. Children practise reading items out before changing anything.

Slicing comes next — taking a range of items with a start and an end — and carries the same boundary rule, where the end index is not included. Slicing also never modifies the original list, which is worth knowing before meeting the operations that do.

The last segment is the one that matters most and is almost always skipped elsewhere: what happens when you copy a list. Assigning one list to a new name does not make a second list, it makes a second name for the same list, so changing one appears to change the other. This is a documented misconception that survives well into adult programming, and the topic makes it visible on screen rather than leaving it to be discovered painfully later.

Python from this topic

hoard = ["ruby", "coin", "crown"]
print(hoard[0])
print(hoard[1:3])

Output

ruby
['coin', 'crown']

Python covered here

  • Creating a list
  • Indexing from zero
  • Slicing with [start:end]
  • append() — adding an item
  • remove() — taking an item out
  • What copying a list actually does
  • Looping over a list

The mistake this topic is built to fix

Common mistakeA child writes copy = hoard, changes copy, and is surprised that hoard changed too.

Assignment copies the reference, not the contents — both names now point at the same list. This misconception outlives childhood; the topic shows the shared list directly instead of describing it.

The lessons, in order

  1. Lists and indexingA row of things, and how to pick out one item at a time.4 exercises
  2. Slicing — taking a piecehoard[start:end] gets a range of items — and never changes the original list.3 exercises
  3. Changing a listappend, remove — and the surprising truth about copying a list.3 exercises
  4. The Grand Inventory CheckLists, loops, and decisions — sorting a whole hoard, one item at a time.3 exercises
  5. Real copies, and the None trap.copy() and [:] make a genuine second list — and why hoard = hoard.sort() empties it.3 exercises

Lessons unlock in order within a topic, so nothing arrives before the idea it depends on. This topic is part of PRO — $6.99 unlocks it along with everything else.

Try it now

The very first level needs no account at all — see whether it clicks before signing up for anything.

Play the first level free →