Python Lists
Sometimes you only need to remember a single value, such as a year the user has entered, but most often you rather need to remember many values of the same type, such as:
- All the years the user has entered to your program.
- The name of all your friends.
- The name of all the files in a directory.
Instead of having 50 variables to store 50 different values (which also limits out program to handle at most 50 different values), we can put as many values as we want (and need) in a list. Let's see how to do that in this lecture.
Lecture material
Recommended reading
- The following chapters in the book How to Think Like a Computer Scientist: Interactive Edition: