def
keyword in Python). Anonymous function can be created using the lambda
statement, it is a single line function. This function helps in reducing the line of code required for defining a short function.## Example 1: Return sum of 2 numbers
# syntax => lambda arguments : expression
my_function = lambda a, b: a + b
# Notice: 'a+b' is the return statement without using 'return' keyword
## Calling the function
print(my_function(1, 1)) # 2