Randomly Printing "True" Instead of Question
eighty (2)

For reasons I can't quite work out, after answering a few questions, it'll print the text "True" instead of a question. However, it's still possible to answer the question correctly, since there's still a valid answer.

I believe this is tied to the fact that I'm checking for repeat random numbers, and something is going wrong there. I'm not sure though, and even if I was, I have no idea how to solve the problem.

Help is appreciated.

You are viewing a single comment. View All
Answered by ArchieMaclean (730) [earned 5 cycles]
View Answer
eankeen (997)


one point of error could be that you are not checking to see if a particular element in the questions array is equal to True before printing it. On line 33, you set a particular element in the array to True. You may want to use a different array to track completed questions, or, like I said you can test if the element value is True before printing it out to the user. :)

If that is not the error, it may be that the bug is difficult to find because of the many global variables. You could refactor your code to eliminate many of the harmful global variables so you can keep track of the values easier.

hope i could help :)