Count how many times each status appears and return the two most common statuses.
Answer
`collections.Counter` is designed for frequency tables. Construct it directly from the iterable and use `most_common(2)` instead of manually maintaining a dictionary and then sorting it yourself. Counter remains a dict subclass, so normal key lookup still works while the specialized API makes the intent explicit.
Strong answer includes
- uses collections.Counter
- uses most_common for ranking
- recognizes Counter as a specialized frequency mapping
Practical example
Python
Result
Run the code to see the result.
Counter counts in one pass and `most_common` returns `(value, count)` pairs ordered by decreasing count.
Expected result: Counter({'passed': 3, 'failed': 2, 'skipped': 1}) and [('passed', 3), ('failed', 2)].