Quiz Yourself on Iterators and Generators

Test yourself on iterators and generators with Python.

Quiz

1

What will be the output of the following code snippet?

import itertools
t1=(1, 3, 6)
t2=[4, 1, 4]
t=itertools.chain(t1, t2)
print(next(t1))
A)

Syntax Error

B)

TypeError: ‘tuple’ object is not an iterator

C)

No Error

D)

AttributeError

Question 1 of 30 attempted

Get hands-on with 1200+ tech skills courses.