PY-3

Summarize Collection Records

  • Easy–Medium
  • Collections
  • Python

Task

Write summarize_records(records, threshold). Each item in records is a two-item tuple containing a person's name and a non-empty list of scores:

(name, scores)

Return a tuple (latest_by_name, strong_names) where:

  • latest_by_name is a dictionary mapping each name to the final score in that person's score list; and
  • strong_names is a set containing each name whose final score is greater than or equal to threshold.

Names in the input are unique. The function must not change the outer list, the tuples, or any score list.

Example

Your implementation

Edit solution.py and keep this function name and signature:

An empty records list must return ({}, set()). Use the final score, not the first or largest score. The threshold is inclusive: a final score equal to it belongs in strong_names.