All problems
EasyFunctions
filter() — keep positives
Keep only the positive numbers from a list using `filter`.
- #filter
- #lambda
Sample input
[-2, 3, -1, 7, 0, 5]
Sample output
[3, 7, 5]
filter-positives.py
Output
Press "Run code" to execute.
Loading…
Keep only the positive numbers from a list using `filter`.
[-2, 3, -1, 7, 0, 5]
[3, 7, 5]
Press "Run code" to execute.