The perceptron learning algorithm:
1 All weights are initially set to zero.
2 For each training example:
if the perceptron outputs 0 when it should output 1, then add the input vector to the weight vector.
if the perceptron outputs 1 when it should output 0, then subtract the input vector to the weight vector.
Repeat step 2 until the perceptron yields the correct result for each training example.