---
title: "What is meant by lambda function in python?"  
description: "What is meant by lambda function in python?"  
author: "Amrita Bhattacharjee"  
published: 2023-03-28  
updated: 2023-05-01  
canonical: https://www.mindstick.com/forum/157632/what-is-meant-by-lambda-function-in-python  
category: "python"  
tags: ["python"]  
reading_time: 1 minute  

---

# What is meant by lambda function in python?

What is meant by [lambda function](https://www.mindstick.com/forum/1967/lambda-function-using-unknown-parameter) in [python](https://www.mindstick.com/articles/75378/simple-yet-useful-tips-when-using-python)?Give suitable example.

## Replies

### Reply by Krishnapriya Rajeev

In Python, a **[lambda](https://www.mindstick.com/blog/181/lambda-expression-in-c-sharp) [function](https://www.mindstick.com/articles/13001/multi-statement-table-valued-user-defined-function-in-sql-server)** is a nameless function that can have arguments of any number. It is defined with a single expression that is evaluated and the result returned when the function is called.

## Syntax:

```python
lambda arguments: expression
```

## Example:

```python
x = lambda a : a + 15  //adding 15 to argument a and returning result
print(x(5))
#OUTPUT: 20
```

Lambda functions are used when a small function is needed temporarily, and defining a complete function is not necessary. They are also useful as arguments for higher-order functions like **map()**, **filter()**, and **reduce()**. The lambda function takes a list of arguments separated by commas, and the expression is the code that gets executed when the function is called.

For example, here is a lambda function that takes two arguments and returns their sum:

```python
add = lambda x, y: x + y
```

This lambda function can be called like any other function:

```python
print(add(2, 3))
#OUTPUT: 5
```


---

Original Source: https://www.mindstick.com/forum/157632/what-is-meant-by-lambda-function-in-python

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
