a=[1,2,3,4] b=[sum(a[0:x+1]) for x in range(0,len(a))] print(b)
Learn more efficiently, for free:
Introduction to Python
7.1M learners
Introduction to Java
4.7M learners
Introduction to C
1.5M learners
Introduction to HTML
7.5M learners