QuizLander
← Tous les quiz publics

Python — Comprehensions, iterators & generators

par Jude · 23/05/2026 · 5 vues · 0 partages

Comprehensions (list/dict/set), iterator protocol, yield, generator pipelines and itertools. 20 questions.
20
Questions
🇬🇧 English
Langue
🔴 Difficile
Difficulté
Démarrer le quiz (invité ou compte)
Partager comme image

Aperçu des questions

  1. 1. What does [x * x for x in range(5) if x % 2] evaluate to?
  2. 2. Difference between (x for x in r) and [x for x in r]?
  3. 3. What protocol must an iterator implement?
  4. 4. What does this print?
    def gen():
        yield 1
        yield 2
        yield 3
    
    print(sum(gen()))
  5. 5. What is the output?
    def gen():
        x = yield 1
        yield x + 10
    
    g = gen()
    print(next(g))
    print(g.send(5))

… et 15 autres questions.

Commentaires

Connecte-toi pour commenter.

Chargement…