def assignMembership(strands, centroids): k = len(centroids) membership = [] for strand in strands: minDistance = float("inf") for c in xrange(k): d = DS.distance(strand, centroids[c]) if (d < minDistance): minDistance = d minCluster = c membership.append((minCluster, strand)) return membership