A list is an important data structure that allows us to store multiple values under one name, similar to how we can store multiple characters (e.g., letters) in one string . In fact, both lists and strings are sequences , a category of types for positionally ordered collections of items. (E.g., a string is a collection of characters ordered by the indices, 0, 1, 2, ..., n-1, where n is the length of the string.)

Lecture Prep

Watch:
  1. List Expressions (5 minutes) The list is one of Python's most useful built-in types. A list is mutable, unlike a string or a tuple.
  2. Slice Visualization (4 minutes) How do we visualize lists? As a sequence, a list can be sliced. A slice of a list is a new list.
  3. List Methods (3 minutes) There are many list methods, some of them you have seen before when we discussed strings.
  4. Mutable List Functions (4 minutes) We can define functions that modify the values in a list, just like we can define functions that modify attribute values in an object.

Or Read: 10.0 - 10.2, 10.4 - 10.6, 10.8 - 10.13


Lecture materials

Slides: individual slides for viewing , 6-up layout for printing

Examples: medals.py
To download the above .py files, right-click (Windows) or command-click (Macs) on the filename and then select "Save link as".
This way you choose where the files will be saved, instead of having your computer save to the default folder (from which you will later have to move your files for organization).

Link to Lecture Recording