human
Give me a code to count pairs with Even Product from two given arrays and the other steps required given the following:
Count pairs with Even Product from two given arrays | Function to count pairs ( arr [ i ] , brr [ j ] ) whose product is an even number.
Stores count of odd numbers in arr [ ].
Stores count of odd numbers in brr [ ].
Traverse the array , arr [ ].
If arr [ i ] is an odd number.
Update cntOddArr.
Traverse the array , brr [ ].
If brr [ i ] is an odd number.
Update cntOddArr.
Return pairs whose product is an even number.
Driver Code"
Solution in Python:
assistant
#Here is code to count pairs with Even Product from two given arrays and the other steps required.
 def cntPairsInTwoArray ( arr , brr , N , M ) :
	cntOddArr = 0
	cntOddBrr = 0
	for i in range ( N ) :
		if ( arr [ i ] & 1 ) :
			cntOddArr += 1
	for i in range ( M ) :
		if ( brr [ i ] & 1 ) :
			cntOddBrr += 1
	return ( N * M ) - ( cntOddArr * cntOddBrr )
if __name__ == ' _ _ main _ _ ' :
	arr = [ 1 , 2 , 3 ]
	N = len ( arr )
	brr = [ 1 , 2 ]
	M = len ( brr )
	print ( cntPairsInTwoArray ( arr , brr , N , M ) )