Consume a Record Batch Generator

Use a generator to yield consecutive batches of at most size records, and return its batches as a list of lists. Preserve order and include a final short batch. An empty record list returns []; a non-positive integer size returns None.

Difficulty: intermediate

Examples

  • [[1,2,3,4,5],2][[1,2],[3,4],[5]]

Your solution

Python

Results

Python starts when you run or submit this challenge.

Back to Lesson