In [2]:

```
import math
import numpy as np
def dist(a, b):
return math.sqrt(math.pow(a[0]-b[0],2) + math.pow(a[1]-b[1],2))
```

In [3]:

```
centroids = [ (2, 5), (8, 3), (4,5) ]
x = (0, 8)
```

In [4]:

```
# Calculating Euclidean Distance between x and centroid
centroid_distances =[]
for centroid in centroids:
print("Euclidean Distance between x {} and centroid {} is {}".format(x ,centroid, dist(x,centroid)))
centroid_distances.append(dist(x,centroid))
```