Write Python programs that sum all the items in the list.

Python Python List (Article) Python List (Program)

92

Program:

def sum_oflist(items):
    sum_ofnumbers = 0
    for n in items:
        sum_ofnumbers += n
    return sum_ofnumbers

# function call
print(sum_oflist([1,2,-8]))

Output:

-5

Explanation:


This Particular section is dedicated to Programs only. If you want learn more about Python. Then you can visit below links to get more depth on this subject.