# Lambda Function

**URL:** <https://forum.codewithmosh.com/t/lambda-function/6855>\
**Category:** Python\
**Created:** [August 17, 2021, 5:16pm UTC](https://forum.codewithmosh.com/t/lambda-function/6855 "2021-08-17T17:16:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Khaledrc](https://avatars.discourse-cdn.com/v4/letter/k/96bed5/32.png) [@Khaledrc](https://forum.codewithmosh.com/u/Khaledrc)\
**Post date:** [August 17, 2021, 5:16pm UTC](https://forum.codewithmosh.com/t/lambda-function/6855/1 "2021-08-17T17:16:45Z")

</div>

Hi folks,

Can someone help me please? I am not sure I can get my head around the Lambda function. In the below example, what does the number ‘1’ stand for in item [1]? Thanks!

items = [

```
("mango", 2), ("pear", 50), ("tomato", 33), ("juice", 31), ("crisps", 23)

```

]  
filtered = list(filter(lambda item: item[1] \>= 1, items))  
print(filtered)

---

<div class="post-metadata">

**Author:** ![eelsholz](https://avatars.discourse-cdn.com/v4/letter/e/439d5e/32.png) [@eelsholz](https://forum.codewithmosh.com/u/eelsholz)\
**Post date:** [August 18, 2021, 1:05am UTC](https://forum.codewithmosh.com/t/lambda-function/6855/2 "2021-08-18T01:05:48Z")

</div>

Each item in the items list is a tuple, and you can get the values in a tuple by their index. So for example, this tuple…

```auto
("tomato", 33)

```

has two values, `"tomato"` in position 0 and and `33` in position 1. So `item[1]` for this tuple is `33`. So I think your lambda is saying, give me all the items in the list where the quantity (or whatever the second value represents) is 1 or greater.

---

<div class="post-metadata">

**Author:** ![Khaledrc](https://avatars.discourse-cdn.com/v4/letter/k/96bed5/32.png) [@Khaledrc](https://forum.codewithmosh.com/u/Khaledrc)\
**Post date:** [August 18, 2021, 8:24am UTC](https://forum.codewithmosh.com/t/lambda-function/6855/3 "2021-08-18T08:24:33Z")

</div>

Aahh, makes sense. Why did I not think of that? 😃 Thanks very much, that’s very helpful of you!
