programming-examples/python/List/Python program to sum all the items in a list.py

6 lines
151 B
Python
Raw Normal View History

2019-11-15 12:59:38 +01:00
def sum_list(items):
sum_numbers = 0
for x in items:
sum_numbers += x
return sum_numbers
print(sum_list([1,2,-8]))