Discussion :: Python MCQs
-
What is the output of the code shown below?def f(x):yield x+1print("test")yield x+2g=f(9)
Answer : Option D
Explanation :
The code shown above will not yield any output. This is because when we try to yield 9, and there is no next(g), the iteration stops. Hence there is no output.
Be The First To Comment