Apply function to each element of a list
I think you mean to use map instead of filter: Even simpler, you could use str.upper instead of importing from string (thanks to @alecxe): In Python 2.x, map constructs a new list by applying a given function to every element in a list. filter constructs a new list by restricting to elements that evaluate to True with a given function. In Python 3.x, map and filter construct iterators instead of lists, so … Read more