×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Python
Posted by: Matthew J_
Added: Jun 22, 2022 1:31 PM
Modified: Jun 23, 2022 12:00 AM
Views: 0
Tags: no tags
  1. #Filter Function
  2.  
  3. list1=[10,20,30,40,50,60,70,80]
  4. filterlist = [i for i in filter(lambda x:x>30,list1)]
  5.  
  6. print(filterlist)
  7. # Output: [40, 50, 60, 70, 80]
  8.  
  9.  
  10. # or alternative
  11.  
  12. lst= [5,6,7,8,10,20,30]
  13. res = [i for i in lst if i > 10]