Exercise: Scoreboard

A teammate wrote record, which adds a score to a scoreboard dict. It passed their one quick test, but in production every new scoreboard already has everybody else's scores in it.

Read the code and spot the problem from two pages ago. Also, callers keep writing record("ana", 3, board), and reviewers want the board passed by name so the call is clear.

Exercise: fix record so that:

  • Calls without a board each get a brand new, empty board.
  • A board passed in is updated in place and returned (the same object).
  • board is keyword-only, so record("ana", 3, {}) raises TypeError.

Press Check to run the tests.