What is the output of the following Python code?
def gen():
yield 1
yield 2
g = gen()
print(next(g), next(g), next(g, 'end'), next(g, 'end'))- AStopIteration is raised
- B1 2 end end
- C1 2 end None
- D1 2 None None
Correct answer: B
What is the output of the following Python code?
def gen():
yield 1
yield 2
g = gen()
print(next(g), next(g), next(g, 'end'), next(g, 'end'))