0

I want to make a quiz (5 questions) in which a timer (50 seconds) is running. The quiz should end either when the time is up or the user answers all questions.

I am pretty new to the coding world, but I already made the quiz (in German) with if, elif, else. So, the only thing is that I have no idea how to make the timer and make it skip other questions if the user is too slow.

lepsch
  • 8,927
  • 5
  • 24
  • 44
gopnik
  • 3
  • 2
  • Does this answer your question? [How to limit execution time of a function call?](https://stackoverflow.com/questions/366682/how-to-limit-execution-time-of-a-function-call) – matszwecja Aug 29 '22 at 08:00

1 Answers1

0

It is hard to answer without seeing your code. But if you set up a timer:

https://www.udacity.com/blog/2021/09/create-a-timer-in-python-step-by-step-guide.html#:~:text=To%20create%20a%20simple%20timer,each%20component%20inside%20the%20module.

As the user answers the quiz you can store his answers in a dict_of_answers = {}. By adding it dict_of_answers[question_number] = answer.

At the end of the timer you can call the function that loads the result of the quiz by checking what is the current answers you have in dict_of_answers

gvn
  • 90
  • 8