0 out of 464 challenges solved
**Question:** Write a function called `filter_lists` that takes a function and a list as input and applies the function to each element in the list. The function should return a new list containing only the elements for which the function returns `True`. **Example:** Input: `filter_lists(lambda x: x % 2 == 0, [1, 2, 3, 4, 5, 6])` Output: `[2, 4, 6]`
def filter_lists(func, lst):
"""
Applies a function to each element in a list and returns a new list containing only the elements for which the function returns True.
Args:
func (function): The function to apply to each element.
lst (list): The input list.
Returns:
list: The new list containing the filtered elements.
"""
# TODO: Implement the filter_lists function
pass