Storing and Accessing Data in Lists

Table 8, Gray Whale Census, shows the number of gray whales counted near the Coal Oil Point Natural Reserve in a two-week period starting on February 24, 2008.[4]

Table 8. Gray Whale Census

Day

Number of Whales

Day

Number of Whales

1

5

8

6

2

4

9

4

3

7

10

2

4

3

11

1

5

2

12

7

6

3

13

1

7

2

14

3

Using what we have seen so far, we would have to create fourteen variables to keep track of the number of whales counted each day:

images/lists/list.png

To track an entire year’s worth of observations, we would need 365 variables (366 for a leap ...

Get Practical Programming, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.