Change to: cumulative.append(my_sum) my_sum = 0 for number in data: cumulative = [] my_sum = my_sum + number print(cumulative) data = [1,2,2,5]
Change to:
cumulative.append(my_sum)
my_sum = 0
for number in data:
cumulative = []
my_sum = my_sum + number
print(cumulative)
data = [1,2,2,5]