Quiz Catalog

Catalog of quizzes

def func():
  yield 1
  return 2
  yield 3

for i in func():
  print(i)
1
  • generator/definition
  • iterator

def numbers_range(n):
  for i in range(n):
    yield i

a = numbers_range(4)

print(next(a))
0
  • statement/yield
  • generator/definition