Single Choice Not Set

QWhat will be the output after the following statements?
 def gen():
    x = 2
    while True:
        yield x
        x += 1
y = gen()
for i in y:
    if i >= 5:
        break
    else:
        print(i, end='')

ID: #3554 Python Generators MCQ 786 views
Question Info
#3554Q ID
Not SetDifficulty
Python Generators MCQTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A 0123 ✔ ✖
  • B 123 ✔ ✖
  • C 12345 ✔ ✖
  • D 234 ✔ ✖
Correct Answer

Explanation

234

Share This Question

Challenge a friend or share with your study group.