Cheatsheet

Chunk list into sublists of size n

def chunker(l: list, n: int):
    """
    Create a list of lists where
    each sublist is of size `n`
    """
    for i in range(0, len(l), n):
        yield l[i:i + n]