Filter Python Lists with Lambda

Python

Uses lambda to filter the original list so only values over 14 are included in the new iterable. Note: the created iterable is converted back into a list.

 1|  original_list = [11, 13, 15, 17]
 2|  
 3|  filtered_list = list(filter(lambda x: x > 14, original_list))
 4|  
 5|  >> [15, 17]
Did you find this snippet useful?

Sign up for free to to add this to your code library