Python Program to find sum of array

 21 - Feb - 2022
 XpertPhp
 24

In this article, We will explain to you the python program to find sum of array. so you can see our python example. Example

def _sum(arr): 
    sum=0
    for i in arr:
        sum = sum + i
          
    return(sum) 

arr=[]  
arr = [12, 100, 200, 10] 
n = len(arr) 
  
ans = _sum(arr) 
print ('Sum of the array is ', ans) 
Output
Sum of the array is 322