# In k-means or kNN, we use euclidean distance to calculate the distance between nearest neighbours. Why not manhattan distance?

In k-means or kNN, we use euclidean distance to calculate the distance between nearest neighbours. Why not manhattan distance ?

No, KNN is generic and you can use any valid metric you want. For example, cosine distance is another metric that is used frequently. Here is an implementation in scikit-learn where you can choose among several distance options. You can also define your own metric to use.