From a96ecbcba397c9f5684db17b1c53339fa8e4886c Mon Sep 17 00:00:00 2001 From: kharrell4 <kharrell4@huskers.unl.edu> Date: Fri, 19 Jul 2024 17:58:46 -0500 Subject: [PATCH] Added a score and question number reset after answering five questions. --- main.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 3836c4f..c1fd557 100644 --- a/main.py +++ b/main.py @@ -112,14 +112,18 @@ class QuizzerApp(App): question = self.questions[-1] if len(self.questions) > 0 else QuizzerApp.DEFAULT_QUESTION self.paused = True self.correct = answer == question[2] + if self.correct == True: + self.score+=100 + self.num_answered += 1 Clock.schedule_once(lambda delta: self.unpause(), PAUSE_TIME) + if self.num_answered%5 == 0: + self.score = 0 + self.num_answered =0 def unpause(self): self.paused = False - if self.correct == True: - app.score+=100 - self.num_answered += 1 + #self.num_answered += 1 if len(self.questions) > 0: self.questions.pop() if len(self.questions) == 0: -- GitLab