Run
my_list = ['apple', '', '', 'banana', 'cherry', ''] # Lamdba function with filter() result = filter(lambda x: len(x) != 0, my_list) # Converting the returned iterable to a list result = list(result) print(result)
Output