Python readings – lambda functions

In python you can create anonymous function which are called lambda function. Here is an example for adding two numbers with a function and lambda function.


#!/usr/bin/python

def sum(a, b):
    return a+b

lambdasum = lambda arg1, arg2: arg1 + arg2;

print  Sum using funtion : , sum( 10, 20 )
print  Sum using lambda : , lambdasum( 10, 20 )

Leave a Reply

Your email address will not be published. Required fields are marked *