September 2013
Intermediate to advanced
350 pages
9h 38m
English
Here is the same bird-watching observation file that we saw in Arctic Birds:
| | canada goose |
| | canada goose |
| | long-tailed jaeger |
| | canada goose |
| | snow goose |
| | canada goose |
| | long-tailed jaeger |
| | canada goose |
| | northern fulmar |
Suppose we want to know how often each species was seen. Our first attempt uses a list of lists, in which each inner list has two items. The item at index 0 of the inner list contains the species, and the item at index 1 contains the number of times it has been seen so far. To build this list, we iterate over the lines of the observations file. For each line, we iterate over the list, looking for the species on that line. If we find that the species occurs in the list, we add one to the number ...
Read now
Unlock full access