split into list into even chunks

Solutions on MaxInterview for split into list into even chunks by the best coders in the world

showing results for - "split into list into even chunks"
Maja
19 Apr 2019
1def chunks(l, n):
2    n = max(1, n)
3    return (l[i:i+n] for i in range(0, len(l), n))
4