filter() — filters the given sequence with the help of a function that tests each element in the sequence to be true or not.

filter(function, iterable)
# function that filters vowels 
def fun(variable): 
    letters = ['a', 'e', 'i', 'o', 'u'] 
    if (variable in letters): 
        return True
        return False
# sequence 
sequence = ['g', 'e', 'j', 'k', 's', 'a', 'r'] 
# using filter function 
filtered = filter(fun, sequence) 
print('The filtered letters are:') 
for s in filtered: 

Is normally used with Lambda functions to separate list, tuple, or sets.

filter() — Structure map

Clickable & Draggable!

filter() — Related pages: