filter function python exemple code example
Example 1: python filter
number_list = range(-5, 5)
less_than_zero = list(filter(lambda x: x < 0, number_list))
print(less_than_zero)
# Output: [-5, -4, -3, -2, -1]
Example 2: js filter method in python
list( filter((lambda x: x < 0), range(-10,5)))