Checkpoint

Checkpoint: The Watch Log

Every night, the lighthouse keepers write what happened in a watch log. Most entries are written at 20:00 by Pip, so those should be the defaults.

This checkpoint uses the whole chapter: default values, keyword arguments, and the safe None default for lists.

Assignment

  1. Give log_line the defaults hour=20 and keeper="Pip". It returns f"{hour}:00 {event} ({keeper})". So log_line("Lit the lamp") gives "20:00 Lit the lamp (Pip)".
  2. Fix add_line(line, log). It appends line to log and returns the log. When no log is passed, it must start a new empty list every time. Right now, every call shares one list!