human
Count pairs in an array containing at least one even value | Function to count the pairs in the array such as there is at least one even element in each pair.
Generate all possible pairs and increment then count if the condition is satisfied.
Driver code.
Function call"
How can the above be solved in Python?
assistant
#Here is code to count pairs in an array containing at least one even value and the other steps required.
 def CountPairs ( arr , n ) :
	count = 0
	for i in range ( n ) :
		for j in range ( i + 1 , n ) :
			if ( arr [ i ] % 2 == 0 or arr [ j ] % 2 == 0 ) :
				count += 1
	return count
arr = [ 8 , 2 , 3 , 1 , 4 , 2 ]
n = len ( arr )
print ( CountPairs ( arr , n ) )