This commit is contained in:
Hodza Alban
2018-02-28 08:34:07 +01:00
committed by GitHub
parent b011d16324
commit 169057b6b7

View File

@ -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 ]
```
```