1 Answer
+ 4
CodePlayground has a Python result for kmeans:
https://code.sololearn.com/c8HhbpMrgs0G/?ref=app
You can find KNN (k nearest neighbor) in the SimpleAI github repository (third link down) here:
https://wiki.python.org/moin/PythonForArtificialIntelligence
You'll want to drill down into the machine learning directory and open the classifiers source file.
If you have a github account, you can fork this project and get your very own copy.