Learn

Lists order items so that they’re in a specific sequence. For example the comic strip, as a list, stores frames in a specific order. Without an order, the story wouldn’t make sense!

This idea of sequence is important because it tells us that each value has a specific position in the list. The position of value in a list is known as its index. You can think of an index like an address - it’s what we use to locate an item in a list.

List indices (the plural of index) are numbers. Usually, lists will start their index at 0 and then add one for each value. So if you want to select the first item in the list, make sure to remember to use 0 in order to do so!

list_indices

Knowing an item’s index allows us to select a value from a list and do something with it, like save it to a variable. It can also be useful in modifying a list, whether by adding something or removing it.

Instructions

You’ve created a comic strip and sent it to an editor for review. Your editor has asked you to make some changes to the frame at index 1.

Click to select the frame that is at index 1.

Hint: index 1 is equivalent to the second position in the list.

Sign up to start coding

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?