MCPcopy Create free account
hub / github.com/Mrinank-Bhowmick/python-beginner-projects / check_answer

Function check_answer

projects/Online Trivia/main.py:13–23  ·  view source on GitHub ↗
(question, answer, score)

Source from the content-addressed store, hash-verified

11
12
13def check_answer(question, answer, score):
14 correct_answer = html.unescape(question["correct_answer"]).lower()
15 answer = answer.lower()
16
17 if answer == correct_answer:
18 print("Correct Answer! \nYour score is", score + 1)
19 return True
20 else:
21 print("Wrong Answer! \nYour score is", score - 1)
22 print(f"The correct answer is {html.unescape(question['correct_answer'])}")
23 return False
24
25
26def display_question(question, question_number, score):

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected