How do we tell the algorithm what the right answer is?
Exactly!
We have to give it data such as pairs of input and output.