weight = [10, 3, 7, 9, 6, 5, 2]
def listsum(numlist):
sum = 0
for i in numlist:
sum = sum + i
return sum
listsum(weight)
I have this simple function to add the values of weight together and am expecting a total of 42 however when I run the function, I don't get any errors or anything.
I am not sure what's going on and have been trying to search various answers for the past 20 mins to no avail. Can someone point me in the right direction here? Thank you
print(listsum(weight))Sormy_suminstead ofsum.def listsum(numlist): return sum(numlist)