Lambda:-
lambda is used to define an anonymous function which is used only once.
it takes an argument and expression it can have any number of arguments but only one expression
Syntex:
lambda a,b:a+b
Map:-
Map takes two parameters and it is used to update values
map(function or none, iterable)
filter:
filter takes two parameters
map(function or none, iterable)
when the function given is true it stores the value in variable
ex:-
numbs=[1,2,3,4,5,6,7,8]
y=list(filter(lambda a: a%2==0,numbs))
x=list(map(lambda a:a*a,y))
print(x)
Comments
Post a Comment