PythiloEasy · 12 min · Task 32 of 100 · progress kept in this browser

Split a list into chunks

Return consecutive list chunks of at most size elements, preserving order. size is positive. The final chunk may be shorter.

items = [1, 2, 3, 4, 5]
print(list(range(0, len(items), 2)))
print(items[4:6])
Your task

Return consecutive list chunks of at most size elements, preserving order. size is positive. The final chunk may be shorter.