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))[/code]

Đức Linh

New member
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ìm kiếm

Back
Top