I'm writing a code which calculates the sum of the numbers beside it.
For example, list1 = [10, 20, 30, 40, 50]
, the new list = [30 (10+20), 60 (10+20+30), 90 (20+30+40), 120 (30+40+50), 90 (40+50)]
. => final list = [30, 60, 90, 120, 90]
.
At the moment my idea was of using a for loop but it was totally off.