Skip to content

Commit

Permalink
lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
mageswarand committed Jul 26, 2019
1 parent 9265389 commit 9124b71
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions Python/lamda.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import functools

fun = lambda x, y : x*y

# print(fun(10, 20))



def func(x, y):
return x*y

# print(func(10, 20))


#--------------------- filter ----------------
L = [1,2,3,4,5,6]

Y = filter(lambda x : x%2 ==0 , L)

print(Y)
print(list(Y))

#--------------------- Map ----------------

M = map(lambda x: x*x , L)
print(list(M))

#--------------------- reduce ----------------

R = functools.reduce(lambda x, y : x+y , L)


0 comments on commit 9124b71

Please sign in to comment.