Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Chunk by Mycroft0121
from typing import Iterable
def chunking_by(items: list, size: int) -> Iterable:
# your code here
if not len(items):
return items
if size>len(items):
return [items]
ans = []
for i in range(len(items)//size):
ans.append(items[size*i:size*i+size])
if size*i+size
Jan. 24, 2022
Comments: