“Reducir el mapa y filtrar las funciones en Python” Código de respuesta

Reducir el mapa y filtrar las funciones en 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

Reducir el mapa y filtrar las funciones en Python

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

Reducir el mapa y filtrar las funciones en Python

{16, 1, 4, 9}
Jittery Jackal

Respuestas similares a “Reducir el mapa y filtrar las funciones en Python”

Preguntas similares a “Reducir el mapa y filtrar las funciones en Python”

Más respuestas relacionadas con “Reducir el mapa y filtrar las funciones en Python” en Python

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código