Lambda Function in Python
Concept & Code
Example 1:
>>> add = lambda x, y: x+y
>>> add(2,3)
5
Example 2:
>>> r = lambda a: [i for i in range(1, a, 10)]
>>> r(50)
[1, 11, 21, 31, 41]
Example 1:
>>> add = lambda x, y: x+y
>>> add(2,3)
5
Example 2:
>>> r = lambda a: [i for i in range(1, a, 10)]
>>> r(50)
[1, 11, 21, 31, 41]
Comments
Post a Comment