Help creating a function or loop to check for correct answers

If you could share sample data on a copy/paste friendly format (or ideally a complete REPRoducible EXample (reprex)) maybe we could give you a better solution than a loop.