List Filtering Function

  • Share this:

Code introduction


This function takes a list and a filtering function as arguments, and returns a new list containing all elements that pass the filtering function test.


Technology Stack : List comprehension

Code Type : Filter list

Code Difficulty : Intermediate


                
                    
def a_filter(input_list, filter_func):
    return [item for item in input_list if filter_func(item)]