human
Give me a code to count number of ordered pairs with Even and Odd Sums and the other steps required given the following:
Count number of ordered pairs with Even and Odd Sums | function to count odd sum pair.
if number is even.
if number is odd.
count of ordered pairs.
function to count even sum pair.
Driver code"
How can the above be solved in Python?
assistant
#Here is code to count number of ordered pairs with Even and Odd Sums and the other steps required.
 def count_odd_pair ( n , a ) :
	odd = 0
	even = 0
	for i in range ( 0 , n ) :
		if ( a [ i ] % 2 == 0 ) :
			even = even + 1
		else :
			odd = odd + 1
	ans = odd * even * 2
	return ans
def count_even_pair ( odd_sum_pairs , n ) :
	total_pairs = ( n * ( n - 1 ) )
	ans = total_pairs - odd_sum_pairs
	return ans
n = 6
a = [ 2 , 4 , 5 , 9 , 1 , 8 ]
odd_sum_pairs = count_odd_pair ( n , a )
even_sum_pairs = count_even_pair ( odd_sum_pairs , n )
print ( " Even ▁ Sum ▁ Pairs ▁ = " , even_sum_pairs )
print ( " Odd ▁ Sum ▁ Pairs = " , odd_sum_pairs )