def sumOfArr(a): sum=0 for i in a: sum += i return sum a = [1,2,3,4] res=sumOfArr(a) print(res) # output = 10