
Checkpoint
Checkpoint: The Fishing Report
The fishers of Teal Cove scribble their catches on slips of paper,
like 2026-05-01 eel. The harbor master wants a quick report. Use
the tools from this chapter: dates, namedtuple, Counter and
defaultdict.
Catch is ready: a namedtuple with the fields day and fish.
Assignment
parse_catch(line): split a line like"2026-05-01 eel"at the first space. Return aCatchwhosedayis adateand whosefishis the name.favorite_fish(catches): return the name of the most common fish. Use aCounter.fish_by_day(catches): return adictthat maps eachdayto a list of its fish, in their original order. Use adefaultdict.days_fished(catches): return how many days there are from the first catch to the last, counting both ends.
parse_catch(line): split a line like"2026-05-01 eel"at the first space. Return aCatchwhosedayis adateand whosefishis the name.favorite_fish(catches): return the name of the most common fish. Use aCounter.fish_by_day(catches): return adictthat maps eachdayto a list of its fish, in their original order. Use adefaultdict.days_fished(catches): return how many days there are from the first catch to the last, counting both ends.
main.py Python sleeping
Press Run to try your code, then Check to test it.