So far I have
def cartesiantopolar(x,y): a=math.atan(y/x) if x<=0 and y<=0: a=a-math.pi return math.sqrt(x**2+y**2),a