Complete worked example
python
def country_summary(countries):
counts = {}
for country in countries:
counts[country] = counts.get(country, 0) + 1
return {"counts": counts, "unique": sorted(set(countries))}- Reasoning
- Counts retain occurrences while the sorted set exposes distinct country values.