Skip to main content

Section 31.5 What’s the average pollution?

This time, we would like to get the average pollution level. To do that, we need to take every PM2.5 value and add them all together. As we do this, we need to keep a count of how many values we have seen, so we can compute an average.

Checkpoint 31.5.2.

This program will calculate the average PM2.5 pollution level in the US data. Arrange the blocks in the right order and indent them correctly. You will use all of them.
Now let’s do the same thing for the PM10 values. This program is mostly done. There are a few lines that need to still be written, they are all marked with a TODO comment. Finish up the program so you can find the average PM10 level.
You have attempted of activities on this page.