Skip to content

Commit 1308dcd

Browse files
authored
Add files via upload
Important
1 parent 354927e commit 1308dcd

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

FilterLambdaReduceMap.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from functools import reduce
2+
nums=[3,2,6,8,4,6,2,9]
3+
evens=list(filter(lambda n: n%2==0,nums))
4+
print("Filter : "+str(evens))
5+
doubles=list(map(lambda n: n*2,evens))
6+
print("Map : "+str(doubles))
7+
sum1=reduce(lambda a,b: a+b,doubles)
8+
print("Reduce : "+str(sum1))

0 commit comments

Comments
 (0)