Loading...
The Depth of Field
A easy Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- easy
- Seniority
- junior, mid
Problem
A configuration parser needs to flatten nested data structures to a controlled depth for serialization. Write a function that takes a nested list and a depth integer, and returns a flattened list. Elements nested deeper than the specified depth are left as-is as sublists.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a sandboxed Docker environment and grades it instantly.