hw02: Marathon chip timing
- Due before the beginning of class on Friday, January 9
Gemini Gem
A reminder that for HWs in SD212 this semester, you can collaborate with other current SD212 students as long as you document that in comments, and you can also use the SD212 Gemini Gem that we have created specifically for this class.
(But you aren’t allowed to use other AI tools or get help from people not in SD212 this semester.)
Getting started
Open your SD212 folder that you set up in your previous homework.
Then open a terminal and run this command from your SD212 folder:
git pull
That should download a new folder hw02 for this assignment with the
file times.csv that you will need to work with.
The data
Some of the world’s most famous historical figures (as calculated by Wikipedia page views) have run a chip-timed marathon race. The course was out-and-back, so each runner went over the timing mat twice, once at the beginning when they started and again at the end when they finished.
times.csv is a file containing marathon chip times.
Each name appears twice in this file for the two times they crossed the mat; their marathon time will be the difference between these two time values.
Your task
Write a program marathon.py which reads in the data from a file called
times.csv and prints out the name of the marathon winner, i.e., the
person who had the shortest time from start to finish.
In the sample times.csv file provided, the winner is ChristianBale with an impressive time of 02:09:00. Here’s how it should look if you run it:
We may also test your code with different input files, but they will always be called `times.csv` (so you can just hard-code that filename into your program).roche@ubuntu$python3 marathon.pyChristianBale
Submit command
To submit files for this homework, run one of these commands:
submit -c=sd212 -p=hw02 marathon.py
club -csd212 -phw02 marathon.py