Python Lambda Function – Python Programming

Python Lambda function is a small anonymous function. These functions are called anonymous because they are not declared in the standard manner by using the def keyword. A lambda function can take any number of arguments, but can only have one expression.

Python Function
Image by Lawrence Monk from Pixabay

Lambda Syntax

lambda arguments expression

In Lambda Function the expressions are executed and the result is returned.

Single Argument Lambda Function:

x = lambda a : a + 10
print(x(5))

# Output -> 15

Multiple Argument Lambda Function:

x = lambda a, b : a * b
y = x(5,6)              # y stores return value
print(y)

# Output -> 30
Python Lambda Function Video Tutorial

Whats Next – Python Modules

Share