Challenge: Chaining and Composing Iterators
Desliza para mostrar el menú
Tarea
Desliza para comenzar a programar
Implement the function chained_odds_squared(numbers) that chains together the provided generator functions to process a sequence of numbers:
-
First, use the
filter_oddsgenerator to filter out even numbers from the input iterablenumbers. -
Then, use the
square_numbersgenerator to yield the square of each remaining (odd) number. -
Your function should return an iterator that yields the squared values of odd numbers from the input.
-
Do not create intermediate lists.
Solución
¿Todo estuvo claro?
¡Gracias por tus comentarios!
Sección 5. Capítulo 7
Pregunte a AI
Pregunte a AI
Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla
Sección 5. Capítulo 7