<prompt> Tumia algorithm ya majirani wa karibu zaidi ya K ili kuainisha pointi za data. Andika programu ya Python kufanya hivyo.Pointi za data: 1,2,2,4,2,3,3,5,3,1,5,5,5,3,6,1,6,2,6,4  <response>: Sure, heres an implementation of the K-nearest neighbors algorithm in Python to classify the given data points into two categories 0 or 1:import mathdef knndata, query, k, distance_fn, choice_fn: neighbor_distances_and_indices Calculate the distances between the query point and all data points for index, point in enumeratedata: distance distance_fnpoint, query neighbor_distances_and_indices.appenddistance, index Sort distances in ascending order sorted_neighbor_distances_and_indices sortedneighbor_distances_and_indices Select the first k neighbors k_nearest_distances_and_indices sorted_neighbor_distances_and_indices:k Extract the labels of the k nearest neighbors k_nearest_labels datai-1 for distance, i in k_nearest_distances_and_indices Use the choice function to determine the final label return choice_fnk_nearest_labelsdef euclidean_distancepoint1, point2: sum_squared_distance 0 for i in rangelenpoint1: sum_squared_distance math.powpoint1i - point2i, 2 return math.sqrtsum_squared_distancedef majority_votelabels: vote_counts for label in labels: vote_countslabel vote_counts.getlabel, 0 1 winner maxvote_counts.items, keylambda x:x10 return winner Example usage:data 1,2,1,2,4,1,2,3,1,3,5,1,3,1,0,5,5,0,5,3,0,6,1,0,6,2,0,6,4,0query 4,4k 3prediction knndata, query, k, distance_fneuclidean_distance, choice_fnmajority_voteprintpredictionIn this example, were using Euclidean distance as the distance function and majority voting as the choice function. The program will output 1, since the majority of the nearest neighbors for the query point 4,4 have label 1. 