def avg_by_elem(p):
    """
    Averages the coordinates assigned to centroid
    p: tuple returned by sum_by_elem
    Returns tuple of floats: mean of coordinates
    """
    p, num = p
    avg = map(lambda x:x/num, p)
    return tuple(avg)