Definition of Python Lambda Functions
Lambda Functions are anonymous or unnamed short functions.
Syntax of Lambda Functions in Python
lambda arguments: expression
Examples of Python Lambda Functions
Lambda function with single argument
Code
add = lambda num: num + 5
print( add(2) )
Output
7
Lambda function with multiple arguments
Lambda functions can take any number of arguments
Code
x = lambda a, b : a * b
print(x(5, 5))
output
25
Saraswat World Changed status to publish June 16, 2023
Leave a Reply