Python Programming - Tricky Questions - Discussion
Discussion Forum : Tricky Questions - General Questions (Q.No. 43)
43.
Consider the following Python code:
def my_generator():
for i in range(5):
yield i * 2
result = list(my_generator())
print(result)
What will be the output of this code?
Answer: Option
Explanation:
The generator yields values multiplied by 2 in the range [0, 2, 4, 6, 8].
Discussion:
Be the first person to comment on this question !
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers