Many, many thanks for your elaborate answer! Not only is CodeRunner/Jobe a real masterpiece but you are a true master. Your sharing of your knowledge is really generous.
(I just spent a full weekend trying to install the Jobe Docker image within or parallel to the LXC-container that my Moodle instance is running in. It simply did not work either way I tried. Creating a separate LXC-machine for Jobe was done in less than 30 minutes and is working well now. Brilliant!)
Multi-line repeat-statements not working is not a real issue as the students are beginners and their programs are simple. Thanks for spotting and pointing it out, though!
You are right about the sequentially named loop variables. I did not clearly realize that the pre-processing and the following run of the program are disconnected. Your solution with the replacer function looks really elegant. I have never used this technique up to now. I shall test it extensively together with subprocess running the program file and report back here.