Skip to main content

chunk(items, size)

Signature: chunk(items: List[Any], size: int) -> List[List[Any]]

Split a list into chunks of the specified size. Validates inputs and raises ValueError on bad inputs.

Example

print(chunk([1,2,3,4,5], 2)); # [[1,2],[3,4],[5]]