circle-intersection

Tom is solving an IQ quiz in which he is stuck in a question which says that there are two circles whose center coordinates and radius are given. Now Tom has to find whether the two circles overlap, do not overlap or are tangential with each other. Help Tom in solving the problem.  

Input:
The input to the problem will be the coordinates for the center of each circle, followed by the radius of each circle. The first line of input represents the coordinates of first circle while second line of input represents the coordinate of second circle.

Output:  
The output will state whether the circles overlap, do not overlap, or are tangential.  

Assumptions:  
‘Y’ will indicate that the circles will overlap.  
‘N’ will indicate that the circles do not overlap.  
‘T’ will indicate that the circles are tangential.  

Constraints:
All inputs are integers that lie between 0 to 1000.   

Example:    

Input:
5 5 5 
15 5 5    

Output:
T

SAMPLE INPUT
100 60 52 
200 90 45

SAMPLE OUTPUT
N

Source: hackerearth | Difficulty: EASY


Solutions:
import math
def distance(p0, p1):
	return math.sqrt((p[0] - p1[0])**2 + (p[1] - p1[1])**2)
p=list(map(int,input().split()))
p1=list(map(int,input().split()))
a=distance(p,p1)
b=p[2]+p1[2]
if a==b:
	print('T')
elif a>b:
	print('N')
elif a<b:
	print('Y')
	


import math
def centredist(x1, y1, x2, y2):
	return math.sqrt(((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2)));
x1, y1, r1 = list(map(int, input().split()));
x2, y2, r2 = list(map(int, input().split()));
d = centredist(x1, y1, x2, y2);
if(d == (r1 + r2)):	print("T");
elif(d < (r1 + r2)):	print("Y");
else:	print("N");