human
What is a code to longest subarray with odd product and the other steps required given the following:
Longest subarray with odd product | Function to return length of longest subarray with odd product.
If even element is encountered.
Update maximum.
Driver code"
Solution in Python:
assistant
#Here is code to longest subarray with odd product and the other steps required.
 def Maxlen ( a , n ) :
	ans = 0
	count = 0
	for i in range ( n ) :
		if a [ i ] % 2 == 0 :
			count = 0
		else :
			count += 1
		ans = max ( ans , count )
	return ans
arr = [ 1 , 7 , 2 ]
n = len ( arr )
print ( Maxlen ( arr , n ) )