
Checkpoint
Checkpoint: The Regatta Results
The great boat race around Pythonia is over! The judges have a list of sailors and a matching list of finishing times, in seconds. Help them post the results.
This checkpoint uses the whole chapter: zip, enumerate,
sorted with a key, and any / sum.
Assignment
podium(names, times)returns result lines like"1. Bo 41", fastest (smallest time) first.- Equal times are sorted by name, A to Z.
- Number the lines from 1 with
enumerate. - Pair the lists with
zip(..., strict=True), so different lengths raiseValueError.
anyone_under(times, limit)returnsTrueif at least one time is belowlimit. Useany.average_time(times)returns the average time, rounded to 1 decimal place. Usesum.
podium(names, times)returns result lines like"1. Bo 41", fastest (smallest time) first.- Equal times are sorted by name, A to Z.
- Number the lines from 1 with
enumerate. - Pair the lists with
zip(..., strict=True), so different lengths raiseValueError.
anyone_under(times, limit)returnsTrueif at least one time is belowlimit. Useany.average_time(times)returns the average time, rounded to 1 decimal place. Usesum.
main.py Python sleeping
Press Run to try your code, then Check to test it.