human
Give me a code to count pairs of similar rectangles possible from a given array and the other steps required given the following:
Count pairs of similar rectangles possible from a given array | Function to calculate the count of similar rectangles.
Driver Code.
Input"
Solution in Python:
assistant
#Here is code to count pairs of similar rectangles possible from a given array and the other steps required.
 def getCount ( rows , columns , A ) :
	res = 0
	for i in range ( rows ) :
		for j in range ( i + 1 , rows , 1 ) :
			if ( A [ i ] [ 0 ] * A [ j ] [ 1 ] == A [ i ] [ 1 ] * A [ j ] [ 0 ] ) :
				res += 1
	return res
if __name__ == ' _ _ main _ _ ' :
	A = [ [ 4 , 8 ] , [ 10 , 20 ] , [ 15 , 30 ] , [ 3 , 6 ] ]
	columns = 2
	rows = len ( A )
	print ( getCount ( rows , columns , A ) )