Geradores · exercício 1 de 1 · prévia gratuita
The game so far · chapter 10
Agora: O Pip ainda tem de ser andado à mão.
Missão deste capítulo: Manda o Pip numa patrulha geradora. Resolva os exercícios e, depois, o seu próprio código dá vida a ela.
A generator function uses yield instead of return. Each yield hands out one value, then pauses until the next ask.
Write count() that yields 1, then 2, then 3. Print list(count()).