Perceptron Training Algorithm Python