Check if two given circles touch or intersect each other | Python3 program to check if two circles touch each other or not . ; Driver code
def circle ( x1 , y1 , x2 , y2 , r1 , r2 ) : NEW_LINE INDENT distSq = ( x1 - x2 ) * ( x1 - x2 ) + ( y1 - y2 ) * ( y1 - y2 ) ; NEW_LINE radSumSq = ( r1 + r2 ) * ( r1 + r2 ) ; NEW_LINE if ( distSq == radSumSq ) : NEW_LINE INDENT return 1 NEW_LINE DEDENT elif ( distSq > radSumSq ) : NEW_LINE INDENT return - 1 NEW_LINE DEDENT else : NEW_LINE INDENT return 0 NEW_LINE DEDENT DEDENT x1 = - 10 NEW_LINE y1 = 8 NEW_LINE x2 = 14 NEW_LINE y2 = - 24 NEW_LINE r1 = 30 NEW_LINE r2 = 10 NEW_LINE t = circle ( x1 , y1 , x2 , y2 , r1 , r2 ) NEW_LINE if ( t == 1 ) : NEW_LINE INDENT print ( " Circle ▁ touch ▁ to ▁ each ▁ other . " ) NEW_LINE DEDENT elif ( t < 0 ) : NEW_LINE INDENT print ( " Circle ▁ not ▁ touch ▁ to ▁ each ▁ other . " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " Circle ▁ intersect ▁ to ▁ each ▁ other . " ) NEW_LINE DEDENT