Quiz Yourself on Iterators and Generators

Test your knowledge of iterators and generators.

Quiz

1

What will be the output of the following program?

lst = [n for n in range(2, 50) if n % 2 == 0 and n % 4 == 0]
print(lst)
A)

[2, 4, 8, 12, 16, 18, 20, 24, 28, 32, 36, 40, 44, 48]

B)

[2, 4, 8, 16, 32]

C)

[4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48]

D)

None of the above

Question 1 of 40 attempted

Get hands-on with 1400+ tech skills courses.