I would like to know if there is a Python function to easily sum all the values in a one or two dimensional array?
I have got an array like this:
array = [4,5,6,7,8,9]
I would normally write Python script like this(or in a function):
sum = 0
for i in array:
sum = sum + i
print(sum)
However this become tiresome to write this code in every project I do.
Is there possibly a built-in Python function which would sum all values in an array?