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.)
list
is one of Python's most useful built-in types. A list is mutable, unlike a string or a tuple.
list
methods, some of them you have seen before when we discussed strings.
Or Read: 10.0 - 10.2, 10.4 - 10.6, 10.8 - 10.13
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).