As per my knowledge, you can use the below code to solve the issue:
def sum_array(arr):
total = 0
for i in arr:
total += i
return total
These are the errors which I found in your code:
you are passing array and solve the inputting the values which are not correct. anyone should be used
use cast the integer and later you split the input
You can use the custom function to code instead of coding from scratch.
If you want to know more about the Data Science then do check out the following Data Science which will help you in understanding Data Science from scratch