I’m looking at introducing Julia as an alternative to Matlab in our undergraduate teaching.
Matlab has this neat feature in their introduction course, where the tasks are automatically checked and the student can try again until they get it right (and can only progress after they got it right):
I helped redesign the latest edition of the MIT class mentioned above, and in particular I wrote all the homeworks as Pluto notebooks with automatic feedback. Feel free to poke around at GitHub - mitmath/JuliaComputation: Repository for Common Ground C25 and to ask me any questions! The more you advance in the class, the better the homeworks become
I would definitely recommend that you switch to Pluto.jl Notebooks.
I have developed a simple function in the context of multiple-choice questionnaires mad in Pluto Notebooks that reads as follows:
if typeof(ans) == Nothing
👆 *Please select one option.*
if ans == correct
!!! tip "🎉 Correct!"
!!! danger "👎 Wrong answer"
Try again. **But you should study!!!** 😡
The function takes two arguments: ans, which can be either Nothing (when no answer was provided yet) or a String, and correct, which is the String corresponding to the correct answer.
After each cell with the answer options (usually “a)”, “b)”, “c)”, “d)” and “e)” ) I run my previous function in another cell as:
where q01 is the variable where the answer to question 1 is stored and "b)" is the correct answer. Usually, q01 is bound to a radio selector from PlutoTeachingTools.jl package like this:
@bind q01 Radio(["a)","b)","c)","d)","e)"])
But it should work also with a String not bound to any predetermined answers’ selector.
However, I did not test the function with a more elaborated correct option apart from a small string like "b)".