Day 11Chunk a List
Easylistsslicing
Write chunk(items, size) that splits items into lists of size items each, in order. The last chunk may be shorter.
chunk([1, 2, 3, 4, 5], 2) returns [[1, 2], [3, 4], [5]].
Examples
Example 1
>>> chunk([1, 2, 3, 4, 5], 2) [[1, 2], [3, 4], [5]]
Example 2
>>> chunk(["a", "b", "c"], 3) [["a", "b", "c"]]
Good to know
sizeis at least 1. An empty list gives[].
Run examples checks the 2 examples above. Submit runs all 6 tests, including hidden edge cases, and marks the challenge solved.