Update chunk_into_n.md
This commit is contained in:
@ -5,10 +5,10 @@ tags: list,intermediate
|
||||
|
||||
Chunks a list into `n` smaller lists.
|
||||
|
||||
- Use `math.ceil()` and `len()` to get the size of each chunk.
|
||||
- Use `list()` and `range()` to create a new list of size `n`.
|
||||
- Use `map()` to map each element of the new list to a chunk the length of `size`.
|
||||
- If the original list can't be split evenly, the final chunk will contain the remaining elements.
|
||||
- Use `math.ceil()` and `len()` to get the size of each chunk.
|
||||
- Use `list()` and `range()` to create a new list of size `n`.
|
||||
- Use `map()` to map each element of the new list to a chunk the length of `size`.
|
||||
- If the original list can't be split evenly, the final chunk will contain the remaining elements.
|
||||
|
||||
```py
|
||||
from math import ceil
|
||||
|
||||
Reference in New Issue
Block a user