πŸ“Š Python
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]
πŸ’¬ Discuss
βœ… Correct Answer: (D) [1,3,6,10]

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
176
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Parvesh Kanani
Publisher
πŸ“ˆ
95%
Success Rate