How to add answers to questions generated in a problem generator

Hi everyone! I’m a beginner at Thunkable, I am currently making a math app for my school project and I have a problem generator in my project. Where when you click a button, a randomized equation pops up. I have already coded and designed the problem generator but, I wanted to know if it is possible to put a button that you can click after each problem that has randomly popped up that has the answer to each of the questions.

That probably depends on how complex the problems are. Is it simple addition/subtraction/multiplication/division?

Sure. You can change the value of a label and then make the label visible to reveal the correct answer. You can store the answer values in a list if you like, and then reference them by problem #.

1 Like

What would the blocks look like for that?

No it is complex algebra problems. An example is, 4x+2x+3x+1+2=?, or (2x+3)(3x+1)=

Hey @malia9411tyd! Thanks for your response. I wonder if the app is creating the problems at random or if you will provide a list of these along with a list of solutions

Here is an example of the code I have put. All I know is that when I press the button, a random equation pops up from the numbers I have inserted.

Got it! Do you have a list of answers?

If not, using This site might be helpful. You would include the polynomial in the url and it returns images of the solutions

Well, you would have to parse the response for your purposes and assign the resultant image url as a arc for an image in your app. But totally doable I’d think.

But some of those are equations, like y-3=0, which have a solution (y=3), and some are expressions, like 6x+4+8x+3=, which do not have a solution but can be simplified (14x+7=).

Are you wanting the user to simplify expressions?

And assuming you have a list of answers that match the indexes for your problems (that is, problem #1 has answer #1, problem #2 has answer #2, etc.), then you would have a variable that stores the question # – 1 for the first question, 2 for the second, etc. And something like these blocks:

Screen Shot 2020-03-01 at 6.53.15 PM

1 Like

Yes, I would like the user to simplify the expressions. Would I add these blocks and add all of my information into those two sets of blocks and then delete the one I have currently? Do I also need to add a “reveal button” on my user interface aside from the button where when the user clicks it generates the questions?

You need to first choose a random number from 1 to the length of your list. Assign that number to a variable. Let’s call it problemNum. Use that variable whenever you need to display a problem or answer. The blocks I posted above will work for displaying those from your two lists (problems & answers).

Just so you know, the in list app answers get # app questionNum block above is shown like this in the list components drawer:

Screen Shot 2020-03-02 at 7.51.16 PM

Yes, I believe you’d need a button to reveal the answer as well.

1 Like