Quiz Catalog

Catalog of quizzes

def custom_chain(*iterables):
  for iterable in iterables:
    yield from iterable

for x in custom_chain([1, 2, 3], 'abc'):
  print(x, end=' ')
1 2 3 a b c
  • iterator
  • build-in/yield

def custom_chain(*iterables):
  for iterable in iterables:
    yield from iterable

for x in custom_chain([1, 2, 3], 'abc'):
  print(x, end=' ')
1 2 3 a b c
  • iterator
  • build-in/yield

def increment(n):
  yield n + 1
  
print(type(increment(5)))
<class 'generator'>
  • generator
  • build-in/yield
  • build-in/type

def func():
  yield 'Hello'
  yield 'World'
  yield '!!!'
  
for letter in func():
  print(letter, end=' ')
Hello World !!!
  • generator
  • build-in/yield