Student feedback for multiple correct answers

I am adding two random integers r_1 and r_2. If r_1=0 then n_1=-20. If r_2=0 then n_2=20.

This means that my correct answer could be r_1 + r_2 or n_1 + r_2 or r_1 + n_2 or n_1 + n_2.

How do I code that the correct answer could be any of these four situations.
Screen 4



Am I interpreting this correctly that you would like to avoid either r_1 or r_2 being zero? If so, using

r_1= numericValue("(-1)^${,1)}*${,20)}"
r_2= numericValue("(-1)^${,1)}*${,20)}"

will generate non-zero values for r_1 and r_2 and allow you to have r_1 + r_2` as your only solution, which you already have coded in your input.

Hope this helps!

1 Like