# lambda - To create an anonymous function

A Lambda function is an anonymous function. The term "lambda" comes from the creation of the concept "lambda calculus", by Alonzo Church, which is "a formal system in mathematical logic for expressing computation based on function abstraction and application using variable binding and substitution." That definition is very important, particularly the last part, "variable binding and substituion."

## Example

Python

Copy Code

def getLambda(n): return lambda a: a / n lambdaFunction = getLambda(5) print(lambdaFunction(10))

## Output

Copy Code

2.0

Explanation:

In this example, `getLambda(5)`

determines the denominator `n`

of the lambda function `a / n`

(the value 5 is *bound *to `n`

)* *and returns *a function.* When we call the function with another number, this *substitutes* that number for the variable `a`

in the lambda function `a / n`

.