Loading...
The Chunked Reader
A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
- Seniority
- junior, mid
Problem
Our ingestion pipeline processes files larger than available memory. Write a generator function called chunked_read that takes a list (simulating file lines) and a chunk size, and yields one chunk at a time. Each chunk is a list of up to chunk_size elements. The last chunk may be smaller.
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.