filter list with python

scores = [70, 60, 80, 90, 50]
filtered = filter(lambda score: score >= 70, scores)

print(list(filtered))

# Output:
[70, 80, 90]

Here is what the above code is Doing:
1. We created a list of integers called scores.
2. We created a filter object by passing a lambda function to the filter function.
3. The lambda function checks if the score is greater than or equal to 70.
4. We converted the filter object to a list using the list function.
5. We printed the list.