In [1]:
map(lambda x: x * x, [1,2,3])
Out[1]:
In [2]:
filter(lambda x: x > 3, [1,2,3,4,5,4,3,2,1])
Out[2]:
In [4]:
nums = [1,2,3,4,5,6]
plusOneNums = [x+1 for x in nums]
plusOneNums
Out[4]:
In [6]:
oddNums = [x for x in nums if x % 2 == 1]
print oddNums
In [7]:
oddNumsPlusOne = [x+1 for x in nums if x % 2 ==1]
print oddNumsPlusOne
In [ ]: