Question: I want to know what exactly is `lambda` in python? and where and why it is used.
thanks

Answer: 
The `lambda` construct is a shorter way to define a simple function that calculates a single expression. The `def` statement can be inconvenient and make the code longer, broken up and harder to read through. The functions created by the two are virtually the same by the way they work, the difference is that `lambda` is limited to a single expression the value of which is returned and that `def` assigns a name to the function and adds it to the local variables by that same name. Also `lambda` can be used in an expression directly, while `def` is a statement.

```
def f(x, y):
    return x + y

```

Would give you *almost* the same result as

```
f = lambda x, y: x + y

```

And you can use it directly in an expression

```
g(5, 6, helper=lambda x, y: x + y)

```

which with `def` would be less concise

```
def helper_function(x + y):
    return x + y

g(5, 6, helper=helper_function)

```
The first linked returned by googling "python lambda" points to a [page](http://www.secnetix.de/olli/Python/lambda_functions.hawk) whose first paragraphs answer your question. I could copy & paste the content it, but I think it's unfair :)