sum of subarray in python
def SubArraySum(arr, n):
n = len(arr)
temp,result = 0,0
# Pick starting point
for i in range(0, n):
# Pick ending point
temp=0;
for j in range(i, n):
# sum subarray between
# current starting and
# ending points
temp+=arr[j]
result += temp
return result