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

  1. parse_catch(line): split a line like "2026-05-01 eel" at the first space. Return a Catch whose day is a date and whose fish is the name.
  2. favorite_fish(catches): return the name of the most common fish. Use a Counter.
  3. fish_by_day(catches): return a dict that maps each day to a list of its fish, in their original order. Use a defaultdict.
  4. days_fished(catches): return how many days there are from the first catch to the last, counting both ends.