I'm trying to ask a question on python, so that if the person gets it right, they can move onto the next question. If they get it wrong, they have 3 or so attempts at getting it right, before the quiz moves onto the next question. I thought I solved it with the below program, however this just asks the user make another choice even if they get it correct. How do I move onto the next question if the user gets it correct, but also gives another chance to those that get it wrong?
score = 0
counter = 0
while counter<3:
answer = input("Make your choice >>>> ")
if answer == "c":
print("Correct!")
score += 1
else:
print("That is incorrect. Try again.")
counter = counter +1
print("The correct answer is C!")
print("Your current score is {0}".format(score)
Aucun commentaire:
Enregistrer un commentaire