Multiple choice task with displayed answer and in/correct answer registered (urgent!)

PsychoPy Version 2021.2.3

What are you trying to achieve?:
This is my first experiment and I don’t understand much of coding. I’m using Builder and the experiment should be run online.
One routine in my experiment (in a loop together with other routines) includes a multiple choice task, i.e. a question and three answer options. I would like for the participants to see what answer they give and to see later in the data file whether they gave the correct answer or not.

What did you try to make it work?:
So far, I have inserted three text components into my routine, one with the question and three with the options (I tried putting everything in one text component which didn’t work, see below). The text always refers to the conditions file ($cont_Que, $answ_Opt1, $answ_Opt2, $answOpt3), set every repeat. I also have a column with corrAns in that file (being either a, b, or c).

For the response I have included a keyboard component since this allows me to check for the correct answer. However, I don’t know how to display the answers the participants give on the screen. I do not want them to know whether their answer was correct or not (no feedback), but ideally, they’d see and be able to edit their answer, plus in the data, I would see whether their answer was correct or not.
I also have a button to click that forces end of routine and continues to the next loop repetition.

What specifically went wrong when you tried that?:
When I tried putting the question and the answer options in one text component, with a new line each time, the text shown was simply $cont_Que, $answ_Opt1, etc. Did I miss something here, is it possible to include everything in one component?

For displaying answers, I have read something on the forum about combining a text component and a code component, but I didn’t quite get what I’d need to do…
Could I maybe use a textbox component (which automatically displays text AND is editable) and add some code so that the data will later show whether it was a correct or an incorrect answer?
Even better would it be to only allow one letter in that textbox, to avoid answers like “ab” because the participant forgot to delete the first letter.

If you need any more info or a Python transcript please let me know.

I would use event.keys() in a code component for this to allow maximum flexibility.

My Brookes Template 2020 demo includes free text responses, as does digit span, free recall and key check.