Ask coding questions

← Back to all posts
need help and idk what the problem is
Kavin1983 (1)

I made this quiz and whenever I enter the right answer it's not adding a point to the correct value I made. whenever I enter all the correct questions it says that I got 10 incorrect, I need some help.

Answered by 19ecal (230) [earned 5 cycles]
View Answer
Comments
hotnewtop
19ecal (230)

This is because user_input is defined at the top as whatever you answer to Do you want to play this game (yes/no)?
Try doing

for question in questions:
    user_input=question_form(question["Question"])
    if user_input==question["answer"]
        correct+=1
    else:
        incorrect+=1
Kavin1983 (1)

@19ecal thanks, I did not notice that.

Kavin1983 (1)

@19ecal thanks, this really helped