Skip to content
Quiz · Modules, files and generators · lesson 10 of 12

Quiz — a generator twice

What does the program print?

Python
def evens(limit):
    for n in range(0, limit, 2):
        yield n


g = evens(7)
print(sum(g), sum(g))

Subscribe to take the course

The course is free. Sign in with Telegram and subscribe to the channel to open every lesson.

Sign in another way