human
Find the coordinates of the fourth vertex of a rectangle with given 3 vertices | Function that return the coordinates of the fourth vertex of the rectangle.
Save the coordinates of the given vertices of the rectangle.
1 - based indexing.
Driver code"
Solution in Python:
 What is a code to find the coordinates of the fourth vertex of a rectangle with given 3 vertices and the other steps required?
assistant
#Here is code to find the coordinates of the fourth vertex of a rectangle with given 3 vertices and the other steps required.
 def findFourthVertex ( n , m , s ) :
	row = dict . fromkeys ( range ( n ) , 0 )
	col = dict . fromkeys ( range ( m ) , 0 )
	for i in range ( n ) :
		for j in range ( m ) :
			if ( s [ i ] [ j ] == ' * ' ) :
				row [ i ] += 1 ;
				col [ j ] += 1 ;
	for keys , values in row . items ( ) :
		if ( values == 1 ) :
			x = keys ;
	for keys , values in col . items ( ) :
		if ( values == 1 ) :
			y = keys ;
	return ( x + 1 , y + 1 ) ;
if __name__ == " _ _ main _ _ " :
	s = [ " * . * " , " * . . " , " . . . " ]
	n = len ( s ) ;
	m = len ( s [ 0 ] ) ;
	rs = findFourthVertex ( n , m , s ) ;
	print ( rs [ 0 ] , rs [ 1 ] )