Lesson 9: Lists — list, Indexes & append()
So far every variable held a single value; a list holds several values together. Instead of creating a separate variable for each item, you can put everything inside one list and access each item by its position.
A list is like a row of boxes. Each box holds one item, and each box has a position number: 0, then 1, then 2. You can look at an item by its position, and you can add a new item to the end with append().
- list
- A data structure that stores several values in order.
- index
- The position number of an item in a list. In Python it starts from 0.
- append()
- A method that adds a new item to the end of the list.