Write a Machine Learning Learning Algorithm (Python)