Hello! I want to make a quiz app with multiple answers and the information to be taken from a table. I made a part of it, but I struggle to verify the answers when more than one are correct.
Let me give you an example :
Question - Which of these are numbers?
Answer 1 - thapoijn
Answer 2 - 10
Answer 3 - oiphjquhg
Answer 4 - 197
When the user taps on “verify answer”:
If he selected answer 2 and 4, the answer will be correct.
If he selected answer 2, the answer will be incorrect.
If he selected answer 2 and 3, the answer will be incorrect.
I made a list for the correct answers and a list for the user’s answers. I have to compare them, but I need them to be the same even if the numbers are in the same order. Can you help me?
List 1 [1,3,5]
List 2 [1,5,3]
How do I compare them so that List 1=List 2 ?
… If your lists to compare have the same length, the easiest solution i can think at this late hour (here, In Romania ) is to just sort them and compare:
It means that when I choose the correct answer it colors the button red instead of green. Excuse me if I was not specific enough and thank you for everything!
Can you show the rest of the blocks from that screen? I can’t see where you call the functions or the screen opens/starts event so it’s hard to know why it isn’t working for you.