“Reduzir e filtrar funções de mapa em python” Respostas de código

Reduzir e filtrar funções de mapa em python

def function(a):
    return a*a
x = map(function, (1,2,3,4))  #x is the map object
print(x)
print(set(x))
Jittery Jackal

Reduzir e filtrar funções de mapa em python

def func(x):
    if x>=3:
        return x
y = filter(func, (1,2,3,4))  
print(y)
print(list(y))
Jittery Jackal

Reduzir e filtrar funções de mapa em python

{16, 1, 4, 9}
Jittery Jackal

Respostas semelhantes a “Reduzir e filtrar funções de mapa em python”

Perguntas semelhantes a “Reduzir e filtrar funções de mapa em python”

Mais respostas relacionadas para “Reduzir e filtrar funções de mapa em python” em Python

Procure respostas de código populares por idioma

Procurar outros idiomas de código