1mylist = [5, 4, 6, "other random stuff", True, "22", "map", False, ""]
2
3def multiply_by_two(obj):
4 return obj*2
5
6def is_str(obj):
7 return type(obj) == str
8
9list(map(multiply_by_two, mylist))
10# [10, 8, 12, "other random stuffother random stuff", 2, "2222", "mapmap", 0, ""]
11
12list(filter(is_str, mylist))
13# ["other random stuff", "22", "map", ""]
14
15# You could also use lambdas on both examples:
16list(map(lambda x: x*2, mylist))
17list(filter(lambda x: type(x) == str, mylist))