0
tell me how to use lambda funtion!??????
i am starting pyspark i wanna know what are the import concepts function need to learn inorder to start python
1 Answer
+ 3
lambda x,y: x + y
def fun(x,y): return x + y
You can use a lambda function immediately after the difinition:
print((lambda x: x*2)(5))
ă10
And it's useful when you need a function temporarily:
lst = list(map(lambda x: x+2, [0,1]))
print(lst)
ă[2,3]