Vidyalelo
Python · Q120

Python Lists MCQs: Exam Practice for List Concepts

Programming · Python · question 120

Q120

What will be the output of the following Python 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]
Answer

Answer: Option D

Solution

Answer: Option D
No explanation is given for this question Let's Discuss on Board