No tienes acceso a esta clase

¡Continúa aprendiendo! Únete y comienza a potenciar tu carrera

Playgrounds: Retorna solo palabras de 4 letras y más

24/44

Aportes 335

Preguntas 4

Ordenar por:

¿Quieres ver más aportes, preguntas y respuestas de la comunidad?

Que buenas que están estas prácticas. Todos los cursos deberían tenerlas! 🙌😎

Esta es la solución que realice:

def filter_by_length(words):
   # Escribe tu solución 👇
   return list(filter(lambda numLetters: len(numLetters) >= 4, words))

words = ['amor', 'sol', 'piedra', 'día']
response = filter_by_length(words)
print(response)

Me gusta la simpleza

def filter_by_length(words):
   return list(filter(lambda word : len(word) >= 4, words))

words = ['amor', 'sol', 'piedra', 'día']
print(filter_by_length(words))

Resumen de for, list comprehension, filter y lambda.

# list
words = ['amor', 'sol', 'piedra', 'día']
#cuenta el numero de elementos de words
print(f'List number of words \n{len(words)}')

#realiza un for que cuenta la candidad de letras en la lista words y realiza un append a la lista numbers_wods
numbers_letters = []
for i in words:
    numbers_letters.append(len(i))    
print(f'List number letters in numbers_letters\n{numbers_letters}')

#list comprehension del paso anterior
numbers_letters_v2 = [len(i) for i in words]
print(f'List number letters in numbers_letters_v2 \n{numbers_letters_v2}')

#utilizar filter y lambda para el paso anterior 
def filter_by_length(words):
    numbers_letters_v3 = list(filter(lambda i:len(i) >= 4, words))
    return numbers_letters_v3

print(f'Result of filter_by_length \n{filter_by_length(words)}')

Esta es mi solución 😃

def filter_by_length(words):
   # Escribe tu solución 👇
   palabra = list(filter(lambda x : len(x) >= 4, words))
   return palabra

words = ['amor', 'sol', 'piedra', 'día']
response = filter_by_length(words)
print(response)

En este ejercicio y el pasado, intenté reducir al máximo el numero de lineas y en mi editor funciona perfecto, alguien sabe por qué acá no me corre? 😦

words = [‘amor’, ‘sol’, ‘piedra’, ‘día’]
response = list(filter(lambda word: len(word)>=4, words))
print(response)

Siguiendo un comentario que mencione el ejercicio anterior podemos hacerlo de forma muy resumida:


words = ['amor', 'sol', 'piedra', 'día']
response = list(filter(lambda x: len(x)>=4, words))

print(response)
def filter_by_length(words):
   # Escribe tu solución 👇
   result = list(filter(lambda text : len(text) >= 4 , words))
   return result

words = ['amor', 'sol', 'piedra', 'día']
response = filter_by_length(words)
print(response)
<# Retorna solo palabras de 4 letras y más, reto playground

def filter_by_length(words):
  words = list(filter(lambda i: len(i) >= 4, words))
  return words
  
words = ['amor', 'sol', 'piedra', 'día']
response = filter_by_length(words)
print(response)
> 

filter trabaja con dos partes, la primera una “funcion”, y la segunda un iterable, en este caso, words. En la primera parte el lambda recibe el nombre del iterador (en este caso word) y FILTRA (no confundir con MAP) con la condicional len(word)>=4.

La solucion es:

def filter_by_length(words):

Escribe tu solución 👇

result=list(filter(lambda word:len(word)>=4, words))
return result

words = [‘amor’, ‘sol’, ‘piedra’, ‘día’]
response = filter_by_length(words)
print(response)

def filter_by_length(words):
   return list(filter(lambda x : len(x)>=4, words))

words = ['amor', 'sol', 'piedra', 'día']
response = filter_by_length(words)
print(response)
def filter_by_length(words):
   # Escribe tu solución 👇
   result = list(filter(lambda word: len(word) >= 4, words))
   return result

words = ['amor', 'sol', 'piedra', 'día']
response = filter_by_length(words)
print(response)
def filter_by_length(words):
   # Escribe tu solución 👇
   new_list = list(filter(lambda i : len(i) >= 4, words))
   return new_list

words = ['amor', 'sol', 'piedra', 'día']
response = filter_by_length(words)
print(response)

Mi solución

def filter_by_length(words):
   # Escribe tu solución 👇
   return list(filter(lambda word: len(word)>=4, words))

words = ['amor', 'sol', 'piedra', 'día']
response = filter_by_length(words)
print(response)
```python def filter_by_length(words): # Escribe tu solución 👇 new_words = list(filter(lambda item : len(item) >= 4, words)) return new_words words = ['amor', 'sol', 'piedra', 'día'] response = filter_by_length(words) print(response) ```def filter\_by\_length(words):   # Escribe tu solución 👇   new\_words = list(filter(lambda item : len(item) >= 4, words))   return new\_words words = \['amor', 'sol', 'piedra', 'día']response = filter\_by\_length(words)print(response)
Esta es mi solución😎: ![](https://static.platzi.com/media/user_upload/image-37f2b2b6-7fb6-4af7-a0d4-97ff9903a721.jpg)
```js def filter_by_length(words): # Escribe tu solución 👇 filtered = list(filter(lambda word : len(word) >= 4, words)) return filtered words = ['amor', 'sol', 'piedra', 'día'] response = filter_by_length(words) print(response) ```def filter\_by\_length(words): # Escribe tu solución 👇 filtered = list(filter(lambda word : len(word) >= 4, words)) return filtered words = \['amor', 'sol', 'piedra', 'día']response = filter\_by\_length(words)print(response)
![](https://static.platzi.com/media/user_upload/image-f7a62e91-3e58-4e43-975e-9cf33ff18f99.jpg)
```python def filter_by_length(words): return list(filter(lambda x: len(x)>= 4, words)) words = ['amor', 'sol', 'piedra', 'día'] response = filter_by_length(words) print(response) ```
Mi solución: ![](https://static.platzi.com/media/user_upload/Screenshot%202024-09-01%20at%203.30.39PM-9304aa04-5048-4db3-99ee-7728611c5571.jpg)
```python list(filter(lambda w : len(w) >= 4, words)) ```list(filter(lambda w : len(w) >= 4, words))
```python def filter_by_length(words): # Escribe tu solución 👇 words = filter(lambda words: len(words) >=4, words) return list(words) words = ['amor', 'sol', 'piedra', 'día'] response = filter_by_length(words) print(response) ```
```js def filter_by_length(words): return list(filter(lambda word: len(word) >= 4, words)) words = ['amor', 'sol', 'piedra', 'día'] response = filter_by_length(words) print(response) ```
![](https://static.platzi.com/media/user_upload/imagen-4a645b3c-947c-408e-936a-40ae2c904647.jpg)
aqui mi aporte: ```python def filter_by_length(words): # Escribe tu solución 👇 cuatroLetras = list (filter(lambda x: len (x) >= 4, words)) return cuatroLetras words = ['amor', 'sol', 'piedra', 'día'] response = filter_by_length(words) print(response) ```
Hi, por acá comparto mi solución: ````python def filter_by_length(words): return list(filter(lambda word:len(word)>3, words)) words = ['amor', 'sol', 'piedra', 'día'] response = filter_by_length(words) print(response) ```def filter\_by\_length(words):   # Escribe tu solución 👇   return list(filter(lambda word:len(word)>3, words)) words = \['amor', 'sol', 'piedra', 'día']response = filter\_by\_length(words)print(response) ````
def filter_by_length(words):
   # Escribe tu solución 👇
   result = list(filter(lambda words: len(words) >= 4, words))
   return result

words = ['amor', 'sol', 'piedra', 'día']
response = filter_by_length(words)
print(response)
Excelente el contenido del curso. Me queda una duda después de resolver el ejercicio, pude resolverlo con filter tal como está planteado, pero fue aún más corto resolverlo con list\_comprehension, ¿podría entenderse entonces list\_comprehension como una mejor forma de hacerlo o en qué tipos de casos podría ser más conveniente un método sobre el otro? ![](https://static.platzi.com/media/user_upload/Screenshot_2-f984d5f8-823b-44f7-a272-5d6cca848d9e.jpg)
My answer def filter\_by\_length(words):   # Escribe tu solución 👇   length = list(filter(lambda words: len(words) >= 4, words))   return length words = \['amor', 'sol', 'piedra', 'día']response = filter\_by\_length(words)print(response)
![](https://static.platzi.com/media/user_upload/image-ebe83e77-563d-4093-8b99-27fb80ad7e68.jpg) este como primer intento, y al pasar por chatgpt, corregido es len(i), no i.len ![](https://static.platzi.com/media/user_upload/image-2c46687e-0d68-4dfc-afe6-60c100cfa3a1.jpg)
```js def filter_by_length(words): # Escribe tu solución 👇 return list(filter(lambda x: len(x)>=4,words)) words = ['amor', 'sol', 'piedra', 'día'] response = filter_by_length(words) print(response) ```
![](https://static.platzi.com/media/user_upload/image-8c11e4f5-728e-4ef2-80f6-b02dfcd92702.jpg)
Mi solución: ```python def filter_by_length(words): # Escribe tu solución 👇 response = list(filter(lambda num_words: len(num_words) >= 4, words)) return response words = ['amor', 'sol', 'piedra', 'día'] response = filter_by_length(words) print(response) ```def filter\_by\_length(words):   # Escribe tu solución 👇   response = list(filter(lambda num\_words: len(num\_words) >= 4, words))   return response words = \['amor', 'sol', 'piedra', 'día']response = filter\_by\_length(words)print(response)
Estoy bien emocionada porque cada día entiendo más sobre Python, ya no me siento tan burra
Hola aqui como lo hice, saludos def filter\_by\_length(words):   # Escribe tu solución 👇   new\_list = list(filter( lambda word: len(word) >= 4, words ))   return new\_list words = \['amor', 'sol', 'piedra', 'día']response = filter\_by\_length(words)print(response)
repositorio <https://github.com/angel20125/python-2-comprehension-functions-2024> ![](https://static.platzi.com/media/user_upload/clase-24-reto-filter-3d938e0e-cf3b-4b50-9d7c-18db256b730b.jpg)
```js def filter_by_length(words): # Escribe tu solución 👇 fil_len=list(filter(lambda item : len(item)>=4,words)) return fil_len ```
```js def filter_by_length(words): # Escribe tu solución 👇 fil_len=list(filter(lambda item : len(item)>=4,words)) return fil_len words = ['amor', 'sol', 'piedra', 'día'] response = filter_by_length(words) print(response) ```
def filter\_by\_length(words):   # Escribe tu solución 👇   return list(filter(lambda word: len(word) >= 4, words))   #return \[] words = \['amor', 'sol', 'piedra', 'día', 'hola','cosita']response = filter\_by\_length(words)print(response)
![](https://static.platzi.com/media/user_upload/image-f7b4ad87-b4b8-4a8d-97b4-eb73495db02d.jpg)
Mi práctica: def filter\_by\_length(words): return list(filter(lambda x: len(x) >= 4, words)) words = \['amor', 'sol', 'piedra', 'día'] response = filter\_by\_length(words) print(response) # \['amor', 'piedra'] \# Ejemplo 1 print(filter\_by\_length(\['amor', 'sol', 'piedra', 'día'])) # Salida: \['amor', 'piedra'] \# Ejemplo 2 print(filter\_by\_length(\['rosa', 'gol', 'pez', 'día', 'gafas'])) # Salida: \['rosa', 'gafas']
```python def filter_by_length(words): # Escribe tu solución 👇 return list(filter(lambda x: len(x)>=4 ,words)) words = ['amor', 'sol', 'piedra', 'día'] response = filter_by_length(words) print(response) ```def filter\_by\_length(words):   # Escribe tu solución 👇   return list(filter(lambda x: len(x)>=4 ,words)) words = \['amor', 'sol', 'piedra', 'día']response = filter\_by\_length(words)print(response)
```js def filter_by_length(words): # Escribe tu solución 👇 filter_by_length = filter(lambda words: len(words) >= 4,words) return list(filter_by_length) words = ['amor', 'sol', 'piedra', 'día'] response = filter_by_length(words) print(response) ```def filter\_by\_length(words):   # Escribe tu solución 👇   filter\_by\_length = filter(lambda words: len(words) >= 4,words)   return list(filter\_by\_length) words = \['amor', 'sol', 'piedra', 'día']response = filter\_by\_length(words)print(response)
I'll share my solution but definitely would say is the same of all of us. ```js return list(filter(lambda x:len(x)>=4, words)) ```
````js def filter_by_length(words): # Escribe tu solución 👇 result = list(filter(lambda i: len(i) >= 4, words)) return result words = ['amor', 'sol', 'piedra', 'día'] response = filter_by_length(words) print(response) ```def filter\_by\_length(words): # Escribe tu solución 👇 result = list(filter(lambda i: len(i) >= 4, words)) return result words = \['amor', 'sol', 'piedra', 'día']response = filter\_by\_length(words)print(response) ````def filter\_by\_length(words): \# Escribe tu solución 👇 result = list(filter(lambda i: len(i) \>= 4, words)) return result words = \['amor', 'sol', 'piedra', 'día'] response = filter\_by\_length(words) print(response) ```def filter\\\_by\\\_length(words):   # Escribe tu solución 👇   result = list(filter(lambda i: len(i) \>= 4, words))   return result words = \\\['amor', 'sol', 'piedra', 'día']response = filter\\\_by\\\_length(words)print(response)
Este es mi resultado ```js def filter_by_length(words): # Escribe tu solución 👇 result = list(filter(lambda i: len(i) >= 4, words)) return result words = ['amor', 'sol', 'piedra', 'día'] response = filter_by_length(words) print(response) ```def filter\_by\_length(words):   # Escribe tu solución 👇   result = list(filter(lambda i: len(i) >= 4, words))   return result words = \['amor', 'sol', 'piedra', 'día']response = filter\_by\_length(words)print(response)
Este fue mi resultado ```python def filter_by_length(words): # Escribe tu solución 👇 result = list(filter(lambda i: len(i) >= 4, words)) return result words = ['amor', 'sol', 'piedra', 'día'] response = filter_by_length(words) print(response) ```def filter\_by\_length(words):   # Escribe tu solución 👇   result = list(filter(lambda i: len(i) >= 4, words))   return result words = \['amor', 'sol', 'piedra', 'día']response = filter\_by\_length(words)print(response)
```js def filter_by_length(words): # Escribe tu solución 👇 result = list(filter(lambda i: len(i) >= 4, words)) return result words = ['amor', 'sol', 'piedra', 'día'] response = filter_by_length(words) print(response) ```def filter\_by\_length(words):   # Escribe tu solución 👇   result = list(filter(lambda i: len(i) >= 4, words))   return result words = \['amor', 'sol', 'piedra', 'día']response = filter\_by\_length(words)print(response)
```python def filter_by_length(words): # Escribe tu solución 👇 result = list(filter(lambda i: len(i) >= 4, words)) return result words = ['amor', 'sol', 'piedra', 'día'] response = filter_by_length(words) print(response) ```def filter\_by\_length(words):   # Escribe tu solución 👇   result = list(filter(lambda i: len(i) >= 4, words))   return result words = \['amor', 'sol', 'piedra', 'día']response = filter\_by\_length(words)print(response)
Esta es mi solucion def filter\_by\_length(words):   # Escribe tu solución 👇   result = list(filter(lambda i: len(i) >= 4, words))   return result words = \['amor', 'sol', 'piedra', 'día']response = filter\_by\_length(words)print(response)```js def filter_by_length(words): # Escribe tu solución 👇 result = list(filter(lambda i: len(i) >= 4, words)) return result words = ['amor', 'sol', 'piedra', 'día'] response = filter_by_length(words) print(response) ```
```js def filter_by_length(words): # Escribe tu solución 👇 return list(filter(lambda x : len(x) >= 4, words)) words = ['amor', 'sol', 'piedra', 'día', 'paralelepipedo'] response = filter_by_length(words) print(response) ```def filter\_by\_length(words):   # Escribe tu solución 👇   return list(filter(lambda x : len(x) >= 4, words)) words = \['amor', 'sol', 'piedra', 'día', 'paralelepipedo']response = filter\_by\_length(words)print(response)
def filter\_by\_length(words):   # Escribe tu solución 👇   listax =list(filter(lambda x : len(x) > 3 ,words))   return \[listax] words = \['amor', 'sol', 'piedra', 'día'] response = filter\_by\_length(words)print(response) si debe ser mayor o igual a 4 y partimos del hecho de que un len siempre va a retornar un entero decir >3 o >= 4 da lo mismo
```js def filter_by_length(words): # Escribe tu solución 👇 return list(filter(lambda words:len(words)>= 4,words)) words = ['amor', 'sol', 'piedra', 'día'] response = filter_by_length(words) print(response) ```
![](https://static.platzi.com/media/user_upload/image-cecd7aa9-8d2e-491a-b699-8febf1dbcd4b.jpg) Mi solución
```python [word for word in words if len(word) >=4] ```
```python def filter_by_length(words): return list(filter(lambda word: len(word) >= 4, words)) words = ['amor', 'sol', 'piedra', 'día'] respondese = filter_by_length print(respondese) ```def filter\_by\_length(words):   return list(filter(lambda word: len(word) >= 4, words)) words = \['amor', 'sol', 'piedra', 'día']respondese = filter\_by\_lengthprint(respondese)
Asi resolví la practica def filter\_by\_length(words):   return list(filter(lambda word: len(word) >= 4, words)) words = \['amor', 'sol', 'piedra', 'día']respondese = filter\_by\_lengthprint(respondese)```python def filter_by_length(words): return list(filter(lambda word: len(word) >= 4, words)) words = ['amor', 'sol', 'piedra', 'día'] respondese = filter_by_length print(respondese) ```
Asi resolví la practicadef filter\_by\_length(words):   return list(filter(lambda word: len(word) >= 4, words)) words = \['amor', 'sol', 'piedra', 'día']respondese = filter\_by\_lengthprint(respondese)```js def filter_by_length(words): return list(filter(lambda word: len(word) >= 4, words)) words = ['amor', 'sol', 'piedra', 'día'] respondese = filter_by_length print(respondese) ```
```python def filter_by_length(words): return list(filter(lambda word: len(word) >= 4, words)) words = ['amor', 'sol', 'piedra', 'día'] respondese = filter_by_length print(respondese) ASI RESOLVI LA PRACTICA ```def filter\_by\_length(words):   return list(filter(lambda word: len(word) >= 4, words)) words = \['amor', 'sol', 'piedra', 'día']respondese = filter\_by\_lengthprint(respondese)
Esta fue mi solucion ```python def filter_by_length(words): # Escribe tu solución 👇 return list(filter( lambda word: len(word) >= 4, words)) words = ['amor', 'sol', 'piedra', 'día'] response = filter_by_length(words) print(response) ```def filter\_by\_length(words):   # Escribe tu solución 👇   return list(filter( lambda word: len(word) >= 4, words)) words = \['amor', 'sol', 'piedra', 'día']response = filter\_by\_length(words)print(response)
Esta fue mi solucióndef filter\_by\_length(words):   # Escribe tu solución 👇   return list(filter( lambda word: len(word) >= 4, words)) words = \['amor', 'sol', 'piedra', 'día']response = filter\_by\_length(words)print(response)```js def filter_by_length(words): # Escribe tu solución 👇 return list(filter( lambda word: len(word) >= 4, words)) words = ['amor', 'sol', 'piedra', 'día'] response = filter_by_length(words) print(response) ```
![](https://static.platzi.com/media/user_upload/image-bc55a13f-5491-436d-880e-6d9e3ae1923e.jpg)
```python def filter_by_length(words): # Escribe tu solución 👇 result = list(filter(lambda i: len(i) >= 4, words)) return result words = ['amor', 'sol', 'piedra', 'día'] response = filter_by_length(words) print(response) ```
```js ```
```js def filter_by_length(words): # Escribe tu solución 👇 result = list(filter(lambda i: len(i) >= 4, words)) return result words = ['amor', 'sol', 'piedra', 'día'] response = filter_by_length(words) print(response) ```def filter\_by\_length(words): # Escribe tu solución 👇 result = list(filter(lambda i: len(i) >= 4, words)) return result words = \['amor', 'sol', 'piedra', 'día']response = filter\_by\_length(words)print(response)```python ```
![](https://static.platzi.com/media/user_upload/image-dcb8dd7a-b74b-43b9-9015-9f5f572489dd.jpg)
mi solucion: ```js def filter_by_length(words): # Escribe tu solución 👇 yopuedo = list(filter(lambda x : len(x) >= 4, words)) return yopuedo words = ['amor', 'sol', 'piedra', 'día'] response = filter_by_length(words) print(response) ```def filter\_by\_length(words):   # Escribe tu solución 👇   yopuedo = list(filter(lambda x : len(x) >= 4, words))   return yopuedo words = \['amor', 'sol', 'piedra', 'día']response = filter\_by\_length(words)print(response)
Mi respuesta def filter\_by\_length(words):  \# Escribe tu solución 👇 new\_words = list(filter(lambda x: len(x) >= 4 , words))    return new\_words words = \['amor', 'sol', 'piedra', 'día'] response = filter\_by\_length(words) print(response)
hice la prueba dando el input deseado sin embargo lo califica como malo: ![](https://static.platzi.com/media/user_upload/image-e93ac1bf-9ecc-4eb5-b0eb-b5ab4f9ce55d.jpg)
![](https://static.platzi.com/media/user_upload/platzi_exercices-4e81fcdf-3a34-423c-8b69-ed9f965ada48.jpg)

Esta seria una solución más corta:

words = ['amor', 'sol', 'piedra', 'día']
response = filter(lambda word: len(word) >= 4, words)
print(list(response))
```python def filter_by_length(words): # Escribe tu solución 👇 return list(filter(lambda palabras: len(palabras) >=4, words)) words = ['amor', 'sol', 'piedra', 'día'] response = filter_by_length(words) print(response) ```
mi solución ```js def filter_by_length(words): # Escribe tu solución 👇 return list (filter(lambda i : len(i) >= 4 , words)) words = ['amor', 'sol', 'piedra', 'día'] response = filter_by_length(words) print(response) ```def filter\_by\_length(words):   # Escribe tu solución 👇   return list (filter(lambda i : len(i) >= 4 , words)) words = \['amor', 'sol', 'piedra', 'día']response = filter\_by\_length(words)print(response)
Me emocione de hacerlo solicito sin necesidad de rendirme, tarde poco más de 5 min pero lo logre! Probablemente la mayoria lo hizo así. ![](https://static.platzi.com/media/user_upload/Return_List_Filter%2BLambda%20py-20d017a7-bfff-4955-922d-4ef6cd782ddf.jpg)
```python def filter_by_length(words): # Escribe tu solución 👇 palabras = list(filter(lambda x: len(x) >=4, words)) return palabras words = ['amor', 'sol', 'piedra', 'día'] response = filter_by_length(words) print(response) ```def filter\_by\_length(words):   # Escribe tu solución 👇   palabras = list(filter(lambda x: len(x) >=4, words))      return palabras words = \['amor', 'sol', 'piedra', 'día']response = filter\_by\_length(words)print(response)
Comparto mi solución, esta vez lo hago porque al fin me salió a la primera y es un buen indicador para mi aprendizaje, normalmente me frustraba no poder a la primera pero con práctica y consistencia todos podemos mejorar si a alguno le pasa igual, no te des por vencido! sigamos intentándolo \<def filter\_by\_length(words):   # Escribe tu solución 👇   cumplen = list(filter(lambda x:len(x) >= 4 ,words))   return cumplen words = \['amor', 'sol', 'piedra', 'día']response = filter\_by\_length(words)print(response)>
def filter\_by\_length(words): # Escribe tu solución 👇 result =list(filter(lambda item: len(item) >= 4, words)) return result words = \['amor', 'sol', 'piedra', 'día'] response = filter\_by\_length(words)print(response)
adjunto solución ![](https://static.platzi.com/media/user_upload/image-884d1cc7-1726-4b2d-acc9-918ebea53990.jpg)
```js def filter_by_length(words): result = list(filter(lambda word: len(word) >=4, words)) return result words = ['amor', 'sol', 'piedra', 'día'] response = filter_by_length(words) print(response) ```
por si alguien le funciona mi solución. ![](https://static.platzi.com/media/user_upload/image-78a6ffa4-614d-4a1c-9ecd-743ef4ed978d.jpg)
![](https://static.platzi.com/media/user_upload/imagen-dcb893a1-3de0-458c-8005-6e963f2b028d.jpg)
```js def filter_by_length(words): # Escribe tu solución 👇 return list(filter(lambda elemento : len(elemento) >= 4, words)) words = ['amor', 'sol', 'piedra', 'día'] response = filter_by_length(words) print(response) ```
Aprecio que estén estos espacios para practicar, sería muy difícil aprender y que le quede algo si uno no hace el ejercicio. ```python def filter_by_length(lista): response = list(filter(lambda x: len(x) >= 4, lista )) return response words = ['amor', 'sol', 'piedra', 'día'] response = filter_by_length(words) print(response) ```def filter\_by\_length(lista):   response = list(filter(lambda x: len(x) >= 4, lista ))   return response words = \['amor', 'sol', 'piedra', 'día']response = filter\_by\_length(words)print(response)
def filter\_by\_length(words): \# Escribe tu solución 👇 new\_words = list (filter(lambda words:len(words)>=4,words)) return (new\_words) words = \['amor', 'sol', 'piedra', 'día'] response = filter\_by\_length(words) print(response)

def filter_by_length(words):
return list(filter(lambda x: len(x) >= 4,words))

words = [‘amor’, ‘sol’, ‘piedra’, ‘día’]
response = filter_by_length(words)
print(response)

casi me sale bien, me faltaba el len() pero viendo las soluciones de Uds. pues vi lo que no hacia bien.

```python def filter_by_length(words): return list(filter(lambda x: len(x) >= 4, words)) words = ['amor', 'sol', 'piedra', 'día'] response = filter_by_length(words) print(response) ```
```python def filter_by_length(words): # Escribe tu solución 👇 return list(filter(lambda word: len(word) >= 4, words)) words = ['amor', 'sol', 'piedra', 'día'] response = filter_by_length(words) print(response) words = ['rosa', 'gol', 'pez', 'día', 'gafas'] response = filter_by_length(words) print(response) ```
Mi solución ```python def filter_by_length(words): # Escribe tu solución 👇 words = list(filter(lambda x: len(x) >= 4, words)) return words words = ['amor', 'sol', 'piedra', 'día'] response = filter_by_length(words) print(response) ```def filter\_by\_length(words):   # Escribe tu solución 👇   words = list(filter(lambda x: len(x) >= 4, words))   return words words = \['amor', 'sol', 'piedra', 'día']response = filter\_by\_length(words)print(response)
```js words = ['amor', 'sol', 'piedra', 'día'] response = list(filter(lambda palabra: len(palabra)>=4, words)) print(response) ```words = \['amor', 'sol', 'piedra', 'día']response = list(filter(lambda palabra: len(palabra)>=4, words))print(response)
```js words = ['amor', 'sol', 'piedra', 'día'] response = list(filter(lambda palabra: len(palabra)>=4, words)) print(response) ```
<def filter_by_length(words):
  # Escribe tu solución 👇
  new_words = list(filter(lambda word: len(word) >= 4, words))
  return new_words
words = ['amor' , 'sol', 'piedra', 'día']

response = filter_by_length(words) 
print(response)> 
<def filter_by_length(words):
   # Escribe tu solución 👇
   return [word for word in words if len(word) >= 4]

words = ['amor', 'sol', 'piedra', 'día']
response = filter_by_length(words)
print(response)> 
```js def filter_by_length(words): # Escribe tu solución 👇 new_list = list(filter(lambda word: len(word) >= 4, words)) return new_list words = ['amor', 'sol', 'piedra', 'día'] response = filter_by_length(words) print(response) ```
![](https://static.platzi.com/media/user_upload/image-f29e69cf-b690-4df7-9fc7-eaf00fa6d857.jpg)![](https://static.platzi.com/media/user_upload/image-b9a28806-c68f-4647-8599-8744a778072d.jpg)
Reto : retorna solo palabras de 4 letras y más ![](https://static.platzi.com/media/user_upload/image-e6f6c615-af87-4e38-966d-52282bf0ed6f.jpg)
```js def filter_by_length(words): # Escribe tu solución 👇 four_words = list(filter(lambda fwords: len(fwords) >= 4, words)) return four_words words = ['amor', 'sol', 'piedra', 'día'] response = filter_by_length(words) print(response) ```
def filter\_by\_length(words):   # Escribe tu solución 👇   return list(filter(lambda item: len(item) >=4, words)) words = \['amor', 'sol', 'piedra', 'día']response = filter\_by\_length(words)print(response)
undefined