Split list into n chunks
Chunks a list into n
smaller lists.
- Use
math.ceil()
andlen()
to get the size of each chunk. - Use
list()
andrange()
to create a new list of sizen
. - Use
map()
to map each element of the new list to a chunk the length ofsize
. - If the original list can't be split evenly, the final chunk will contain the remaining elements.