LISTS

Oftentimes when programming, you're going to need a way to organize and manage sets of data. This is no different than in real life. If you're putting together an invite list for a party; or creating a shopping list; or even just a basic To Do list. In each of these situations, organizing data in a list format makes the creating, sorting, managing and finding of the information easier and faster.

Most programming languages have concepts of lists as well, and Python is no exception. As an exmaple, let's consider a list of strings containing the names of the months of the year. To keep things simple, let’s just create a list containing the first five months; we’ll use a variable called “months”:

Notice how the entire list has brackets [] around it. Each of the items in the list are strings and they are separated by commas.

Now let’s look at some of the things we can do with that list:

home