Lists can store several values in one variable. Instead of creating three separate variables, age1, age2 and age3, there can be the single variable ages (see Figure 5.1). There are several benefits from this. First, the code might be cleaner if the number of different variables is limited, and second - and more importantly - lists can store any number of values: 0, 3 or 100. Thus, the coder does not need to know the number of values when writing the program code, unlike when using variables like age1, age2 and age3.
When computing the second-highest number of votes in Chapter 2, we used the follower-variable pattern (as shown in Code Example 2.13). This required us to create two variables: highest_votes and second_highest_votes. However, if we stored all votes in a list (votes) and ordered it in decreasing order, we could easily access the highest and second-highest votes (see Code Example 5.1). The benefit with this approach is that we can as easily access the fifth- or tenth-highest or even the lowest number of votes, as all votes are stored in the same list.