Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprende Challenge: Chaining and Composing Iterators | Python Iterators
Functional Programming Concepts in Python
Sección 5. Capítulo 7
single

single

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_odds generator to filter out even numbers from the input iterable numbers.

  • Then, use the square_numbers generator 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

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 5. Capítulo 7
single

single

Pregunte a AI

expand

Pregunte a AI

ChatGPT

Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla

some-alt