human
Count of sub | Function that returns the count of sub - arrays with odd product.
Initialize the count variable.
Initialize variable to store the last index with even number.
Initialize variable to store count of continuous odd numbers.
Loop through the array.
Check if the number is even or not.
Calculate count of continuous odd numbers.
Increase the count of sub - arrays with odd product.
Store the index of last even number.
N considered as index of even number.
Driver Code.
Function call"
Solution in Python:
assistant
#Here is code to count of sub and the other steps required.
 def countSubArrayWithOddProduct ( A , N ) :
	count = 0
	last = - 1
	K = 0
	for i in range ( N ) :
		if ( A [ i ] % 2 == 0 ) :
			K = ( i - last - 1 )
			count += ( K * ( K + 1 ) / 2 )
			last = i
	K = ( N - last - 1 )
	count += ( K * ( K + 1 ) / 2 )
	return count
if __name__ == ' _ _ main _ _ ' :
	arr = [ 12 , 15 , 7 , 3 , 25 , 6 , 2 , 1 , 1 , 7 ]
	n = len ( arr )
	print ( int ( countSubArrayWithOddProduct ( arr , n ) ) )