The Lazy Unpacker
A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
- Seniority
- L4
Problem
Given a list nested to arbitrary depth, implement a generator (or equivalent) that yields each non-list leaf value in order. The test harness collects the results into a list.
Summary
Instead of loading it all at once, yield it one piece at a time.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.