Skip to content
← Back to Community
Multiple-Choice Quiz
Profile icon
YYChen3

I've got two levels, once you choose one and complete it, you will get a question 'Choose another level', but after I press the second level, it stops. I need some advice on how to keep it running. Please help! Thank you!

Answered by SixBeeps [earned 5 cycles]
View Answer
Voters
Profile icon
AngelicaRegalad
Profile icon
EhabAboaboda
Profile icon
YYChen3
Comments
hotnewtop
Profile icon
SixBeeps

You don't have code to go back to the beginning, so that second choice gets interpreted as Python. Neither a nor b are valid Python code, so that's why you're getting an error.
To make your code go back to the beginning, put your whole program in a while loop:

while True: score = 0 print ("Welcome to THE quiz!") # ...
Profile icon
YYChen3

I've tried it, it still doesn't work. @SixBeeps

Profile icon
SixBeeps

@YYChen3 Looks like you got rid of it while I was away. Did you put everything under the while? (As in, did you indent everything as well?)

Profile icon
YYChen3

Yes, I did. But it still didn't work. @SixBeeps

Profile icon
SixBeeps

@YYChen3 You didn't indent everything

Profile icon
SixBeeps

@YYChen3 Everything needs to be included

Profile icon
SixBeeps

@YYChen3 Honestly it's better to just select everything under the while and hit tab

Profile icon
YYChen3

Thank you! @SixBeeps

Profile icon
ch1ck3n

I don't get any error. the program just stops.

Profile icon
YYChen3

Sorry, that's what I meant. @ch1cken

Profile icon
18jamesea

use a loop