Chapter 9. Lists

The programs we’ve written so far have used ordinary variables to store single pieces of data. Such variables are not as useful, however, when you want to store a bunch of values, such as your friends’ phone numbers, names of books, or a month of temperature readings.

For example, if you wanted your program to remember the phone numbers of 20 of your friends, you’d need 20 variables! Certainly, writing and maintaining a program with 20 variables would be tedious. In this chapter, we’ll explore another built-in data type, called a list, which offers a convenient way to group related values. Here’s what we’ll cover:

  • How to create and manipulate lists

  • Initializing and accessing individual elements in a list

  • Basic sorting and search techniques ...

Get Learn to Program with Scratch now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.