Q. What will be the output of following python code?
Code:
a=[1,2,3,4] b=[sum(a[0:x+1]) for x in range(0,len(a))] print(b)
β
Correct Answer: (D)
[1,3,6,10]
a=[1,2,3,4] b=[sum(a[0:x+1]) for x in range(0,len(a))] print(b)
You must be Logged in to update hint/solution