How do I get the cumulative sum of this list using list comprehension:
list_comp=[1,4,9,16]
Here's what I tried but it prints the double of each item in the list
print([x+x for x in list_comp])
I expect the results to be: list_comp=[1,5,14,30] But I'm getting this:
>> [2, 8, 18, 32]