Articles → Python → Filter Function In Python

Filter Function In Python






Purpose





Syntax


filter(function, collection)



Example




mylist = [1,2,3,4,5]

print(list(filter(lambda num: num %2==0,mylist)))



Output


Picture showing the output of the Filter function in python



Posted By  -  Karan Gupta
 
Posted On  -  Wednesday, March 13, 2019

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250