In [1]:
soma = lambda x, y: x + y
In [2]:
soma(2, 3)
Out[2]:
In [3]:
numeros = [1,2,3,4,5]
In [5]:
map(lambda x: x* 2, numeros)
Out[5]:
In [6]:
for valor in map(lambda x: x* 2, numeros):
print(valor)
In [7]:
for valor in filter(lambda x: x % 2 == 0, numeros):
print(valor)
In [8]:
[x * 2 for x in numeros if x % 2 == 0]
Out[8]:
In [9]:
[x * 2 for x in numeros]
Out[9]:
In [ ]: