Python loops and accumulators
A for loop visits each item from an iterable. An accumulator keeps the partial result between iterations.
Python
def total_of(values):
total = 0
for value in values:
total += value
return total
print(total_of([2, 4, 6]))
assert total_of([]) == 0
assert total_of([-2, 2]) == 0