kmeans.py
def point_avg(points):
    """
    Accepts a list of points, each with the same number of dimensions.
    NB. points can have more dimensions than 2

    Returns a new point which is the center of all the points.
    """
    dimensions = len(points[0])
    print dimensions

    new_center = []

    for dimension in xrange(dimensions):
        dim_sum = 0  # dimension sum
        for p in points:
            dim_sum += p[dimension]

        # average of each dimension
        new_center.append(dim_sum / float(len(points)))

    return new_center

    Accepts a list of points, each with the same number of dimensions.
    NB. points can have more dimensions than 2

    Returns a new point which is the center of all the points.
    
Accepts a list of points, each with the same number of dimensions.
NB. points can have more dimensions than 2

Returns a new point which is the center of all the points.
Accepts a list of points each with the same number of dimensions . NB . points can have more dimensions than 2 Returns a new point which is the center of all the points .
def point_avg(points):
    dimensions = len(points[0])
    print dimensions
    new_center = []
    for dimension in xrange(dimensions):
        dim_sum = 0  
        for p in points:
            dim_sum += p[dimension]
        new_center.append(dim_sum / float(len(points)))
    return new_center
def point_avg ( points ) : dimensions = len ( points [ 0 ] ) print dimensions new_center = [ ] for dimension in xrange ( dimensions ) : dim_sum = 0 for p in points : dim_sum += p [ dimension ] new_center . append ( dim_sum / float ( len ( points ) ) ) return new_center
Accepts a list of points, each with the same number of dimensions.
Accepts a list of points each with the same number of dimensions .
"""
    Accepts a list of points, each with the same number of dimensions.
    NB. points can have more dimensions than 2

    Returns a new point which is the center of all the points.
    """ # dimension sum # average of each dimension
points