This Python script represents a quiz game that tests your knowledge with a set of questions. The script utilizes three main components: Question class, QuizBrain class, and a user interface (QuizInterface) to interact with the quiz.
The Question class represents a question object, containing the text of the question and its correct answer.
The QuizBrain class manages the quiz logic. It takes a list of Question objects and tracks the user's score and progress through the quiz.
The QuizInterface class provides a user interface for the quiz, allowing the user to answer questions interactively.
-
Clone the repository or download the script.
-
Make sure you have the required modules:
question_model,data,quiz_brain, andui. -
Run the script:
python quiz_game.py
-
Answer the questions displayed in the user interface.
-
After completing the quiz, the script will print your final score.
You can customize the quiz questions by modifying the question_data in the data module. Each question is represented as a dictionary with "question" and "correct_answer" keys.
# Example question_data format
question_data = [
{"question": "What is the capital of France?", "correct_answer": "Paris"},
{"question": "Which planet is known as the Red Planet?", "correct_answer": "Mars"},
# Add more questions as needed
]