Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python map and filter

#Using map() and filter() functions add 2000 to the values below 8000.
lst1=[1000, 500, 600, 700, 5000, 90000, 17500]

lst2= list(map(lambda x: x+2000, filter(lambda x: x<8000, lst1)))
print(lst2)

#output = [3000, 2500, 2600, 2700, 7000]
Source by holypython.com #
 
PREVIOUS NEXT
Tagged: #python #map #filter
ADD COMMENT
Topic
Name
6+4 =