The One-of-Each
A easy Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- easy
- Seniority
- L3
Problem
Given a list of dicts (records) and a key name, return a new list containing the first occurrence of each distinct value at that key. Records that do not have the key are kept in order (they are not deduplicated against each other).
Summary
Strip the repeats, keep the originals.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.