What will be the output of the following Python code? [code] a=[1,2,3,4] b=[sum(a[0:x+1]) for x in range(0,len(a))] print(b) [/code]

What will be the output of the following Python code?
Code:
a=[1,2,3,4]
b=[sum(a[0:x+1]) for x in range(0,len(a))]
print(b)
A. 10
B. [1,3,5,7]
C. 4
D. [1,3,6,10]
 

Tìm kiếm

Back
Top