Find the count of even odd pairs in a given Array | Function to count the pairs in array of the form ( even , odd ) ; Check if number is even or not ; Driver code
def findCount ( arr , n ) : NEW_LINE INDENT count = 0 NEW_LINE ans = 0 NEW_LINE for i in range ( 0 , n ) : NEW_LINE INDENT if ( arr [ i ] % 2 == 0 ) : NEW_LINE INDENT count = count + 1 NEW_LINE DEDENT else : NEW_LINE INDENT ans = ans + count NEW_LINE DEDENT DEDENT return ans NEW_LINE DEDENT a = [ 5 , 4 , 1 , 2 , 3 ] NEW_LINE n = len ( a ) NEW_LINE print ( findCount ( a , n ) ) NEW_LINE