Wednesday, 17 February 2021

Lambda Function in Python

 '''

#Function as an object

def sum(a,b):

    return a+b


#k=sum(5,9)

#print(k)


k=sum

print(k(5,10))

print(k(15,10))



def show():

    print("Hello")



m=show

m()

m()

show()




Anonymous or Lambda Function

'''


print((lambda x:2*x)(5))


k=lambda x:x**2

print(k(5))


m=lambda x,y:x+y

print(m(5,10))


No comments:

Post a Comment