Programming Languages

What is the purpose of the lambda function in Python?

Easy
4
Added
The lambda function is a small anonymous function defined with the lambda keyword. It can have any number of arguments but can only have one expression.

Solution Code

Programming Languages
add = lambda x, y: x + y
result = add(5, 3)
print(result)
Explanation
This code snippet demonstrates how to use a lambda function to add two numbers.

Guided Hints

Use lambda to define an anonymous function
Specify arguments and an expression