Ask coding questions

← Back to all posts
I have a list which is supposed to make it ask a question only once but it doesn't
IndyRishi

I have a list with 20 variables that are equal to false at the beginning. When it asks the question, it sets the corresponding variable to true. If it's true, it will ask a different question. But several times, it has asked 2 of the same question.

Voters
IndyRishi
Comments
hotnewtop
sn236

Hi @IndyRishi, I had a question is this your second account - https://replit.com/@RishiSanjeev.

MrVoo

Random numbers can repeat.

IndyRishi

I know but the thing I'm saying is that there is a database made out of variables which can store if the random function has called that number. If true it changes the number.

MrVoo

@IndyRishi Does it only change to number once?

CodingElf66

Create a list of all the questions. For example, consider the following code below:

Then, when a question is selected, append it to a variable. Then, use a for loop and an if statement to check if the same question is used.

Hope this answer helps, and hope you can also mark this as answered!

IndyRishi

@CodingElf66 There is a list of all questions. It's called wordDefinitions.

CodingElf66

@IndyRishi Yes but you have to check if the questions are repeated.

Here, I will show you.

That would be a good solution to perhaps, your problem.