2
I have a problem and I need to create a function that adds the values that are inside a list. I have already done this and the code is below, however, Python returns me the value 3 as a result, when in fact the value should be 103. I can’t find the error at all, if anyone can help I appreciate.
Code below:
def soma(x):
total = 0
for i in x:
total += i
return total
l1 = [3,7,1,90,2]
print(soma(l1))