Assignments > Tutorial 7: Working With Files
Due on Wed, 11/10 @ 11:59PM. 3 Points.
In today’s tutorial, you’re going to calculate some statistics for the Boston Marathon. To do this, you will open some of the files in the boston_marathon
directory, loop through each line in the file, and perform some basic summary statistics.
Please write a program to calculate the following statistics. You can write each program as a separate file, or do all of the calculations in a single file. Up to you.
Please answer the following questions
-
How many people completed the Boston Marathon in 2015?
- What was the average age of someone completing the Boston Marathon in 2015?
- Hint: you may need to use try/except for any messy / unexpected data.
- What was the average time of people who completed the Boston Marathon in 2015?
- Hint: you will have to parse the total time into a number that can be summed. So, you may want to convert all of the times to seconds.
-
What was the average time for Kenyan runners who completed the Boston Marathon in 2015?
- [If Time] What was the average time for female runners in their 30s in 2015?