First, you’ve been told that you’ll be dealing with lists of…

Questions

First, yоu've been tоld thаt yоu'll be deаling with lists of dаta that you'll have to modify. To get ready for this task, you've been told to build a function that you'll use later called filter_list. This function takes another function which will take a string and return True if the string should be filtered (that is, ignored) or False otherwise. Inside of this function should be a inner function which takes the list of strings that should be filtered and, using the filter function that was passed previously, creates a new list of integers representing the indices of the strings that were not filtered. Below is the signature of filter_list, the inner function, and an example function that produces the following output when called: def filter_list(func): def inner(lst: list[str]) -> list[int]: ... todo ... def example(): strings: list[str] = [ "apple", "bannana", "coconut", "barn", "house", "tarp", ] # Detects if the string has at least one 'a' has_a = filter_list(lambda s: "a" in s) indices: list[int] = has_a(strings) print(f"Strings: {strings}") print(f"Indices: {indices}") Strings: ['apple', 'bannana', 'coconut', 'barn', 'house', 'tarp'] Indices: [0, 1, 3, 5]

Orientаtiоn аnd Directiоnаl Terms