Sobes.tech
Intern — Middle

Block generator from sequence

livecode

Task condition

It is necessary to implement a generator function chunk_generator that takes two parameters:

  • iterable – any iterable object;
  • chunk_size – the required size of the block. The function should sequentially return lists (chunks) of the specified size, formed from the elements of the given iterable object.
def chunk_generator(iterable, chunk_size):
    pass
Block generator from sequence - Live Coding Python - sobes.tech