import math


def assign_closest(point_list, centroids, k):

   """

   Assigns each point from list of data points to the cluster with the closest centroid.

   point_list is a 2-dimensional list of data points, each data point being a list of two integers.

   centroids is a 2-dimensional list of points, each point being a list of two integers.

   k is the desired number of clusters and should match the length of centroids.

   """

   new_clusters = [[] for i in range(k)]
   for point in point_list:
      closest = 0
      i = 0
      shortest_distance = -1
      for centroid in centroids:
         distance = math.sqrt((point[0] - centroid[0])**2 + \
                              (point[1] - centroid[1])**2)
         if distance <= shortest_distance or shortest_distance == -1:
            shortest_distance = distance
            closest = i
         i+=1
      new_clusters[closest].append(point)
   return new_clusters