# Python Lambda | How to use lambda in python | Anonymous Function

# Python Lambda

The Function without a name is the Anonymous function and we also called a Lambda function.

A Lambda function uses one expression to take any number of the argument.

#### Syntax:

lambda arguments: expression

#### Example:

Add 5 to the arguments a, And then return the value and print it.

f = lambda a : a + 5

print(f(5))

#### Output:

10

## Example of a Lambda with multiple arguments.

#### Example:

x = lambda a, b : a * b

print(x(15, 6))

#### Output:

90

#### Example:

x = lambda a, b, c : a + b + c

print(x(15, 6, 9))

#### Output:

30

## Why Use Lambda Function? What are the features of the lambda function?

Lambda function is used for nameless function, so we have to use it when we required a function with a short period of time and nameless function.

And lambda contains multiple arguments in one expression.

### Make a function that doubles the number we send:

#### Example:

def myfunc(n):

return lambda a : a * n

mydoubler = myfunc(2)

print(mydoubler(11))

#### Output:

22

#### Example:

def myfunc(n):

return lambda a : a * n

mydoubler = myfunc(2)

mytripler = myfunc(3)

print(mydoubler(8))

print(mytripler(8))

#### Output:

16

24

I have found great and massive information

Python Online Training Hyderabad

Best Python Online Training