Đ Đức Linh New member Sep 20, 2021 #1 What will be the output of the following Python code? Code: def f(x): for i in range(5): yield i g=f(8) print(list(g)) A. [0, 1, 2, 3, 4] B. [1, 2, 3, 4, 5, 6, 7, 8] C. [1, 2, 3, 4, 5] D. [0, 1, 2, 3, 4, 5, 6, 7]
What will be the output of the following Python code? Code: def f(x): for i in range(5): yield i g=f(8) print(list(g)) A. [0, 1, 2, 3, 4] B. [1, 2, 3, 4, 5, 6, 7, 8] C. [1, 2, 3, 4, 5] D. [0, 1, 2, 3, 4, 5, 6, 7]
T Thanh Hoan New member Sep 20, 2021 #2 Answer: a Explanation: The output of the code shown above is a list containing whole numbers in the range (5). Hence the output of this code is: [0, 1, 2, 3, 4]. Upvote 0 Downvote
Answer: a Explanation: The output of the code shown above is a list containing whole numbers in the range (5). Hence the output of this code is: [0, 1, 2, 3, 4].