Update chunk.md
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Chunks an array into smaller lists of a specified size.
|
Chunks an array into smaller lists of a specified size.
|
||||||
|
|
||||||
Uses `range` to create a list of desired size. Then use `map` on this list and fill it with splices of `arr`
|
Uses `range` to create a list of desired size. Then use `map` on this list and fill it with splices of `arr`.
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from math import ceil
|
from math import ceil
|
||||||
@ -17,4 +17,4 @@ def chunk(arr, size):
|
|||||||
|
|
||||||
``` python
|
``` python
|
||||||
chunk([1,2,3,4,5],2) # [[1,2],[3,4],5]
|
chunk([1,2,3,4,5],2) # [[1,2],[3,4],5]
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user