How do we tell the algorithm what the right answer is?

With data such as pairs of input and outputWith output alone

Exactly!

We have to give it data such as pairs of input and output.