human
Write me a code to find the remaining vertices of a square from two given vertices and the other steps required given the following:
Find the remaining vertices of a square from two given vertices | Function to find the remaining vertices of a square.
Check if the x - coordinates are equal.
Check if the y - coordinates are equal.
If the the given coordinates forms a diagonal of the square.
Otherwise.
Square does not exist.
Driver Code.
Given two vertices"
Solution in Python:
assistant
#Here is code to find the remaining vertices of a square from two given vertices and the other steps required.
 def findVertices ( x1 , y1 , x2 , y2 ) :
	if ( x1 == x2 ) :
		print ( ( x1 + y2 - y1 ) , " , " , y1 )
		print ( ( x2 + y2 - y1 ) , " , " , y2 )
	elif ( y1 == y2 ) :
		print ( x1 , " , " , ( y1 + x2 - x1 ) )
		print ( x2 , " , " , ( y2 + x2 - x1 ) )
	elif ( abs ( x2 - x1 ) == abs ( y2 - y1 ) ) :
		print ( x1 , " , " , y2 )
		print ( x2 , " , " , y1 )
	else :
		print ( " - 1" )
if __name__ == ' _ _ main _ _ ' :
	x1 = 1
	y1 = 2
	x2 = 3
	y2 = 4
	findVertices ( x1 , y1 , x2 , y2 )