Template for a single correct answer between three other wrong

Hello, I need a template to create cards with multiple possible answers but just one of them being correct, ideally with a switch for randomly shuffling the answers order or not of a particular card and which dinamically creates the correct a) b) c) and d) letters, depending on the order they appeared, like this:

Question

a) Answer (false)
b) Answer (correct)
c) Answer (false)
d) Answer (false)

The “Multiple Choice for Anki” add-on, code 1566095810 (Multiple Choice for Anki - AnkiWeb) is very close to achieve this and with the included very nice feature of automatically shuffling the answers order, but the answers are wrongly displayed if you fail to select the correct one and I wasn’t able to fix it from the advice in the add-on comment section.

This is the template where you enter:

-The amount of correct answers (“mc” for several, “sc” for just only one)
-The answers and which is the correct one inside the sequential order of 0s and 1s (in this case, “0 0 1 0”, the number 3 answer is the right one):

It works if you select the right answer:

But then, if you fail to select the correct answer, the results are wrongly displayed:
imagen

It gets right that the correct answer was number 3, but it should display:

-All the three wrong answers in red
-The correct answer in green
-The “Correct answers” percentage as 0% (but because this is more useful for the multiple right answers use case, I don’t require this feature)

Any solution is valid for me, either an add-on or just the note code. I’m familiar with HTML and CSS, but I’m new to Anki and I’m not familiar with Python.

Thank you

Maybe related:

2 Likes

Thank you! It’s very strange for me that, for a single correct answer, this is considered expected behaviour by the author. I was acting like it was some kind of bug on my side.

Knowing it was intended behaviour, I kept trying and finally I’ve managed to get a different version to work, which was posted in the add-on comments section to better suit the use case of a single correct answer:

(It’s for replacing the content of the “Back Template” of the “Card Type” inside the “Note code” created by the add-on)

This code shows:

If you select the correct answer:

  • The correct answer is displayed with no background colour (because it’s the one you selected)
  • The wrong answers are displayed in red background colour

If you select a wrong answer:

  • The correct answer is displayed in green background colour
  • The wrong answer you selected is displayed with no background colour (because it’s the one you selected)
  • The remaining wrong answers are displayed in red background colour
1 Like