Lists – Indexing
Square bracket notation accesses a list item by its zero-based integer index
What it does: Unlike strings, list items can be changed by assigning to their index. -1 always gives the last element of a list. Index 0 is always the first item. Indices go from 0 to len-1 — [3] doesn't exist in a 3-item list. in checks if the value exists anywhere in the list. for...in is the standard way to iterate through a list. Assigning to nums[1] replaces the item at index 1 (the second item). The loop goes through items in order — 1 is first.
Common mistakes: List has indices 0,1,2: index 3 is out of range. Use square brackets [] for indexing, not parentheses ().
Free printable worksheet with full answer key — or add this module to a journey and assign it to your class.
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
list[0]Fill in the Blanks
Spot the Error
Create a free class, add this module to a journey, and track who's stuck.
Create a free teacher account →No credit card. No setup fee. Make a class and invite students in under three minutes.
Practice this topic interactively, track progress, and unlock badges.
Start Learning Free →