p
y
c
h
a
l
l
e
n
g
e
r
Home
Intermediate Python
Generators
Generators
generators
yield
generator expression
yield from
lazy iteration
iterators
next
NEXT
Introduction to generators and yield
LESSON
Exercise: Yield three numbers
CHALLENGE
Exercise: Yield squares with a loop
CHALLENGE
Exercise: Pull values out with next()
CHALLENGE
Exercise: Yield only even numbers
CHALLENGE
Generator expressions
LESSON
Exercise: Turn a list comprehension into a generator
CHALLENGE
Exercise: Sum of squares with a generator expression
CHALLENGE
Exercise: Count items that match a condition
CHALLENGE
yield from and chaining generators
LESSON
Exercise: Flatten lists with yield from
CHALLENGE
Exercise: Chain two generators
CHALLENGE