Handling numbers in lists (Python) [duplicate]

Using a for loop:

acc = 0
for num in list1:
    acc += num

Another approach:

acc = sum(list1)

Leave a Comment