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
def findVertices ( x1 , y1 , x2 , y2 ) : NEW_LINE INDENT if ( x1 == x2 ) : NEW_LINE INDENT print ( ( x1 + y2 - y1 ) , " , " , y1 ) NEW_LINE print ( ( x2 + y2 - y1 ) , " , " , y2 ) NEW_LINE DEDENT elif ( y1 == y2 ) : NEW_LINE INDENT print ( x1 , " , " , ( y1 + x2 - x1 ) ) NEW_LINE print ( x2 , " , " , ( y2 + x2 - x1 ) ) NEW_LINE DEDENT elif ( abs ( x2 - x1 ) == abs ( y2 - y1 ) ) : NEW_LINE INDENT print ( x1 , " , " , y2 ) NEW_LINE print ( x2 , " , " , y1 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " - 1" ) NEW_LINE DEDENT DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT x1 = 1 NEW_LINE y1 = 2 NEW_LINE x2 = 3 NEW_LINE y2 = 4 NEW_LINE findVertices ( x1 , y1 , x2 , y2 ) NEW_LINE DEDENT