human
What is a code to sum of all Subarrays and the other steps required given the following:
Sum of all Subarrays | Set 1 | Computes sum all sub - array.
Pick starting point.
Pick ending point.
sum subarray between current starting and ending points.
driver program"
How can the above be solved in Python?
assistant
#Here is code to sum of all Subarrays and the other steps required.
 def SubArraySum ( arr , n ) :
	temp , result = 0 , 0
	for i in range ( 0 , n ) :
		temp = 0 ;
		for j in range ( i , n ) :
			temp += arr [ j ]
			result += temp
	return result
arr = [ 1 , 2 , 3 ]
n = len ( arr )
print ( " Sum ▁ of ▁ SubArray ▁ : " , SubArraySum ( arr , n ) )