Learn
You can access an individual item on the list by its index. An index is like an address that identifies the item’s place in the list. The index appears directly after the list name, in between brackets, like this: list_name[index]
.
List indices begin with 0, not 1! You access the first item in a list like this: list_name[0]
. The second item in a list is at index 1: list_name[1]
. Computer scientists love to start counting from zero.
Instructions
1.
Write a statement that prints the result of adding the second and fourth items of the list. Make sure to access the list by index!
Take this course for free
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.