Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Oppiskele Challenge: Chaining and Composing Iterators | Python Iterators
Functional Programming Concepts in Python
Osio 5. Luku 7
single

single

Challenge: Chaining and Composing Iterators

Pyyhkäise näyttääksesi valikon

Tehtävä

Pyyhkäise aloittaaksesi koodauksen

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.

Ratkaisu

Switch to desktopVaihda työpöytään todellista harjoitusta vartenJatka siitä, missä olet käyttämällä jotakin alla olevista vaihtoehdoista
Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 5. Luku 7
single

single

Kysy tekoälyä

expand

Kysy tekoälyä

ChatGPT

Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme

some-alt