human
Sum of all elements in an array between zeros | Function to find the sum between two zeros in the given array arr [ ].
To store the sum of the element between two zeros.
To store the sum.
Find first index of 0.
Traverse the given array arr [ ].
If 0 occurs then add it to A [ ].
Else add element to the sum.
Print all the sum stored in A.
If there is no such element print - 1.
Driver Code.
Function call"
How can the above be solved in Python?
 ... Write me a code to sum of all elements in an array between zeros and the other steps required?
assistant
#Here is code to sum of all elements in an array between zeros and the other steps required.
 def sumBetweenZero ( arr , N ) :
	i = 0
	A = [ ]
	sum = 0
	for i in range ( N ) :
		if ( arr [ i ] == 0 ) :
			i += 1
			break
	k = i
	for i in range ( k , N , 1 ) :
		if ( arr [ i ] == 0 ) :
			A . append ( sum )
			sum = 0
		else :
			sum += arr [ i ]
	for i in range ( len ( A ) ) :
		print ( A [ i ] , end = ' ▁ ' )
	if ( len ( A ) == 0 ) :
		print ( " - 1" )
if __name__ == ' _ _ main _ _ ' :
	arr = [ 1 , 0 , 3 , 4 , 0 , 4 , 4 , 0 , 2 , 1 , 4 , 0 , 3 ]
	N = len ( arr )
	sumBetweenZero ( arr , N )