Home / Programming MCQs / Python MCQs / Question

P

Parvesh Kanani • 2.84K Points
Extraordinary

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)
(A) 10
(B) [1,3,4]
(C) 4
(D) [1,3,6,10]

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.