Sail E0 Webinar
Question
What is the output of the code shown below?def f(x):    yield x+1    print("test")    yield x+2g=f(9)
Options:
A .  Error
B .  test
C .  test1012
D .  No output
Answer: Option D


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.



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers