funo map 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]
def myMapFunc(s):
return s.upper()
my_str = "welcome to guru99 tutorials!"
updated_list = map(myMapFunc, my_str)
print(updated_list)
for i in updated_list:
print(i, end="")