human
Count of odd and even sum pairs in an array | Function to find the count of pairs with odd sum and the count of pairs with even sum.
To store the count of even and odd number from the array.
If the current element is even.
If it is odd.
To store the count of pairs with even sum.
All the even elements will make pairs with each other and the sum of the pair will be even.
All the odd elements will make pairs with each other and the sum of the pair will be even.
To store the count of pairs with odd sum.
All the even elements will make pairs with all the odd element and the sum of the pair will be odd.
Driver code"
Solution in Python:

What is a code to count of odd and even sum pairs in an array and the other steps required?
assistant
#Here is code to count of odd and even sum pairs in an array and the other steps required.
 def findPairs ( arr , n ) :
	cntEven = 0 ; cntOdd = 0 ;
	for i in range ( n ) :
		if ( arr [ i ] % 2 == 0 ) :
			cntEven += 1 ;
		else :
			cntOdd += 1 ;
	evenPairs = 0 ;
	evenPairs += ( ( cntEven * ( cntEven - 1 ) ) // 2 ) ;
	evenPairs += ( ( cntOdd * ( cntOdd - 1 ) ) // 2 ) ;
	oddPairs = 0 ;
	oddPairs += ( cntEven * cntOdd ) ;
	print ( " Odd ▁ pairs ▁ = ▁ " , oddPairs ) ;
	print ( " Even ▁ pairs ▁ = ▁ " , evenPairs ) ;
if __name__ == " _ _ main _ _ " :
	arr = [ 1 , 2 , 3 , 4 , 5 ] ;
	n = len ( arr ) ;
	findPairs ( arr , n ) ;