I programmed a multiple choice quiz. Here is my code:
questions = {1: "a", 2: "c", 3: "b", 4: "d", 5: "e"}
def trivia():
score = 0
for i in questions:
print(i)
answer = input("Answer: ").lower()
if answer == questions[i]:
print("You got it right.")
score = score + 10
else:
print("You got it wrong.")
score = score - 10
print("Your score is: " + str(score))
trivia()
This is what I want to add to my quiz:
3 hints in total →
I want to provide users 3 hints on any question when they are solving the quiz. For example, if the user got stuck on the first trivia question, the user can type 'hint' or 'h' next to "Answer: " and get a hint for the first question.
Only one hint for each question. Let's say the user used his other hints for the second question and the third question and asked for another hint on the fourth question. Then, I want to print "no hints available" and let the user answer the question without providing any hint for the fourth question. And the user will not be able to get any hints for the fifth question.
I also have to use
continue
andbreak
but I don't know where to use them.