A list in Python is like a row of numbered lockers, side by side, each one holding exactly one item. You open a locker by its number, not by guessing what's inside - and locker numbers always start counting from 0, not 1. So pets[0] opens the very first locker, and pets[1] opens the second one right next to it.
A list stores multiple values together in one ordered container, each one accessible by its position number (starting at 0, not 1). It's how you keep track of a whole collection of things instead of just a single value.
my_list = [item1, item2, item3]
my_list[0] # first item
len(my_list) # how many itemscolors = ["red", "green", "blue"]
print(colors[0])
print(colors[2])
print(len(colors))colors[0] is the FIRST item ('red'), because Python counts positions starting from 0. colors[2] is the third item ('blue'). len(colors) counts how many items are in the list altogether - 3.
colors = ["red", "green", "blue"]
print(colors[-1])Negative indices count backward from the end of a list, the same rule that applies to text: colors[-1] is always the LAST item, no matter how long the list is, without needing to know its exact length.
In the app this lesson continues with the animated explanation, spoken aloud, and then the practice: Print the second item in the list ("dog") instead of the first - remember locker numbers start at 0. The editor runs your child’s real code and checks the result, with their coding buddy reacting to what they wrote.
Try it free