# python: how to sum an array
array = [1, 1, 2, 0, -1]
sum_array = sum(array)
print(sum_array)
# 3
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
# Python code to demonstrate the working of
# sum()
numbers = [1,2,3,4,5,1,4,5]
# start parameter is not provided
Sum = sum(numbers)
print(Sum)
# start = 10
Sum = sum(numbers, 10)
print(Sum)