How to find variable with the highest numerical value, and then print the NAME of the variable

Sorry if this problem has a very obvious solution, but I have spent the last hour trying to do this and failing.

I am making a revision app has users answering the same questions over and over again in order to commit them to memory. (think along the same lines as a language learning flashcard app.

I have created a ‘statistics’ screen where I want to display the questions most commonly answered incorrectly. I have assigned each answer a variable e.g. “answer_failcount” and added it to a list e.g. incorrect_questions_list. Each time the user gets a question wrong, the score of that answer’s variable goes up by one.

I know that I can order the list from lowest to highest, but how do I call the NAME of the variable to show the user which answer they are getting wrong?

Any help would be hugely appreciated!
Thanks heaps

Hey @jhowan,

Using the modes of list block, you can return the mode. In this case, the output is “a”.
image

As far as listing all incorrectly answered questions in order goes, if you build your app around the statistic screen, you can tell the app create the list in order as the user answers them incorrectly, using two lists:

One list is to record the incorrect question, and another to record the value. These lists must always be synced. If the question gets answered wrong, check if this question exists in the first list, if it does, find it’s corresponding index in the second list and change it by +1. If it does not exist (the user hasn’t answered this incorrectly yet), then add the question to the first list, and set its value to 1 in the second list.

That may sound difficult as described above, but it is a very simple method. If you rather record all raw data for future purposes then you may deviate from that solution.

Let me know how you get on, Eoin.