def fun (x): return x**2a = [1,2,3,4,5]b = list(map(f,a))//orb = [x for x in map(f,a)]//1,4,9,16,25 def fun(n): return n%2 == 0a = [1,2,3,4]b = [x for x in filter(fun,a)] //b =[2,4]