human
Count pairs with Bitwise AND as ODD number | Function to count number of odd pairs.
variable for counting odd pairs.
find all pairs.
find AND operation check odd or even.
return number of odd pair.
Driver Code.
calling function findOddPair and print number of odd pair"
How can the above be solved in Python?
assistant
#Here is code to count pairs with Bitwise AND as ODD number and the other steps required.
 def findOddPair ( A , N ) :
	oddPair = 0
	for i in range ( 0 , N - 1 ) :
		for j in range ( i + 1 , N - 1 ) :
			if ( ( A [ i ] & A [ j ] ) % 2 != 0 ) :
				oddPair = oddPair + 1
	return oddPair
a = [ 5 , 1 , 3 , 2 ]
n = len ( a )
print ( findOddPair ( a , n ) )