lambda function or anonymous function in python
x=10
y=20
mul=lambda a,b: a*b #lambda function mul takes variables a and b and returns a*b
print(mul(x,y)) #calling and printing lambda function mul with value of a and b
ad=lambda x,y: x+y #lambda function add takes variable x and y and return x+y
print(ad(x,y)) #calling and printing lambda function add with value of x and y
Comments
Post a Comment