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 O’Reilly online learning.

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