Mapa Fuo Python
lista = [1, 2, -3, 4, 5, -9]
def quadrado(n):
return n*n
map(quadrado, lista)
[1, 4, 9, 16, 25, 81]
Kind Kookaburra
lista = [1, 2, -3, 4, 5, -9]
def quadrado(n):
return n*n
map(quadrado, lista)
[1, 4, 9, 16, 25, 81]
# Python program to demonstrate working
# of map.
# Return double of n
def addition(n):
return n + n
# We double all numbers using map()
numbers = (1, 2, 3, 4)
result = addition(numbers)
print(list(result))