I am new to programming and trying to learn with python. I have this code and expecting to sum the values of an array but getting error.
I have this code that I managed to write based on the things i learned online
def sum_array(arr):
total = 0
for i in range(len(arr)):
total += arr[i]
return total
result = sum_array(1,2,3,4,5)
print("Sum of array:", result)`
I am at lost. Sorry if this is a beginners question
You need to sign in to view this answers
Leave feedback about this