Use a set called seen and a list called unique to deduplicate ids while preserving order
A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
Problem
Use a set called seen and a list called unique to deduplicate ids while preserving order. Loop through ids: if an id is not in seen, add it to seen and append it to unique. Print the unique list, then its length.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.