human
Count number of pairs with positive sum in an array | Returns number of pairs in arr [ 0. . n - 1 ] with positive sum.
Initialize result.
Consider all possible pairs and check their sums.
If arr [ i ] & arr [ j ] form valid pair.
Driver 's Code.
Function call to find the count of pairs"
How can the above be solved in Python?
 ... Can you provide a code to count number of pairs with positive sum in an array and the other steps required?
assistant
#Here is code to count number of pairs with positive sum in an array 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 ] + arr [ j ] > 0 ) :
				count += 1 ;
	return count ;
if __name__ == " _ _ main _ _ " :
	arr = [ - 7 , - 1 , 3 , 2 ] ;
	n = len ( arr ) ;
	print ( CountPairs ( arr , n ) ) ;