Issue #4
This commit is contained in:
@ -6,9 +6,9 @@ Use `filter()` to filter out falsey values (False, None, 0, and "").
|
||||
|
||||
```python
|
||||
def compact(arr):
|
||||
return list(filter(lambda x: bool(x), arr))
|
||||
return list(filter(bool, arr))
|
||||
```
|
||||
|
||||
``` python
|
||||
compact([0, 1, False, 2, '', 3, 'a', 's', 34]) # [ 1, 2, 3, 'a', 's', 34 ]
|
||||
```
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user