Python Lambda Function



lamda is a single expression anonymous function often used as inline function. It takes general form as:
lambda arg1 arg2 ... : expression where args can be used
Example of lambda in python:
>>> triangle_perimeter = lambda a,b,c:a+b+c
>>> triangle_perimeter(2,2,2)
6

No comments:

Post a Comment