From 46f0171d3680f58cc6f75db520aa474623aa058f Mon Sep 17 00:00:00 2001 From: gtitov Date: Thu, 10 Nov 2022 20:20:16 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=B9fix=20#3=20check=20ignores=20case?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index 1e36025..7f021c4 100644 --- a/main.py +++ b/main.py @@ -46,7 +46,7 @@ def check_answers(student_answers: dict): for a in checked_answers["questions"]: question_id = a["id"] a["correct_answer"] = next(question["answer"] for question in all_questions if question["id"] == question_id) # all_questions can be replaced with topic_questions - a["is_correct"] = a["student_answer"] == a["correct_answer"] + a["is_correct"] = a["student_answer"].casefold() == a["correct_answer"].casefold() # make sure answer is str checked_answers["correct"] = sum([a["is_correct"] for a in checked_answers["questions"]]) checked_answers["correct_percent"] = round(checked_answers["correct"] * 100 / len(checked_answers["questions"]))