Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Second solution in Clear category for Chunk by tom-tom
from typing import Iterable
from itertools import islice
def chunking_by(items: list, size: int) -> Iterable:
it = iter(items)
return [c for _ in items if (c := list(islice(it, size)))]
Feb. 19, 2020