Python Programming - Generators - Discussion

Discussion Forum : Generators - General Questions (Q.No. 13)
13.
In a generator function, what does the return statement without a value indicate?
It terminates the generator function with an empty result
It restarts the generator from the beginning
It raises a StopIteration exception
It is not a valid syntax in a generator function
Answer: Option
Explanation:
In a generator function, a return statement without a value indicates that the generator has reached the end of its execution and will terminate with an empty result.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.