Level of Difficulty:
Objective: This workout provides practice in creating functions to implement a filter.
Problem: Create a function that takes a list of non-negative integers and strings and return a new list without the strings.
Examples:
filter_list([1, 2, “a”, “b”]) ➞ [1, 2]
filter_list([1, “a”, “b”, 0, 15]) ➞ [1, 0, 15]
filter_list([1, 2, “aasf”, “1”, “123”, 123]) ➞ [1, 2, 123]
Submission
Simply post your code and a screenshot of your results.
Please format your Python code and blur it or place it in a hidden section.
This workout will be released on Monday April 17, 2023, and the author’s solution will be posted on Sunday April 23, 2023.