Quizzer

Quizzer

A trivia game which uses the turtle module and the requests module to get questions from Open Trivia Database API

About the Quiz Topics:

  • The topic of the quiz is Anime/Manga by default.
  • You can change it by changing the API parameters:
  1. Opening Quizzer/data.py in your editor.
  2. You can change category to “Computer_Science” or “GK”
  3. To get an all-in-one quiz remove category

How to Run:

  • Open terminal and navigate to the file
python main.py

Sample Output

Sample Output

Source Code: main.py

from question_model import Question
from data import question_data
from quiz_brain import QuizBrain
from ui import QuizInterface

question_bank = []
for question in question_data:
    question_text = question["question"]
    question_answer = question["correct_answer"]
    new_question = Question(question_text, question_answer)
    question_bank.append(new_question)


quiz = QuizBrain(question_bank)
ui = QuizInterface(quiz)

while quiz.still_has_questions():
    quiz.next_question()

print("You've completed the quiz")
print(f"Your final score was: {quiz.score}/{quiz.question_number}")