This package helps you manage taking quizzes
Project description
Quizzer App
BuildStamp
The Quizzer App is a software package designed to conduct quizzes. It comprises two sub-packages:
Sub-package #1: User Interface/Quiz Manager (Folder Name: quizuiflowcontrol)
This is the front end of the app where users interact with the system and manage quizzes:
Module1: User interface
- Handles main menu
- Greets the user
- Displays the menu
File: main_menu.py
class QuizApp
: is used to manage the Quiz Application user interface and flow.
Functions
__init__
: Initializes the QuizApp.run
: Starts the main application loop.display_welcome_message
: Displays a welcome message.ask_user_name
: Asks the user to input their name.main_menu
: Displays the main menu and processes user input.show_menu_options
: Shows the available menu options.display_error_message
: Displays an error message for invalid selections.exit_app
: Exits the application.list_quizzes
: Lists all available quizzes.take_quiz
: Handles the logic of taking a quiz.
Module2: Flow control
- Displays a list of available quizzes
- Handles the selection process
- Starts the quiz
- Manages the flow of questions and answers during a quiz session
- Displays and save the results at the end of a quiz
File: quizmanager.py:
class QuizManager
: is used to manages the quizzes, including listing, taking, and saving results of quizzes
Functions
__init__
: Initializes the QuizManager._build_quiz_list
: Builds a list of quizzes from JSON files.list_quizzes
: Lists all available quizzes.take_quiz
: Facilitates taking a quiz.print_results
: Prints the results of the quiz.save_results
: Saves the quiz results to a file.
Sub-package #2: Creates quiz objects from databases gathered from free online sources and communicates with the sub-package #1. (Folder name: quizutils)
Module1: Parsing questions from databases to quiz objects
- Retrieve questions from databases such as JSON
- Parses quizzes
File: quizparser.py
class JSONQuizParser
: is used for importing quiz data from JSON file.
Functions:
import_data
: The function takes the JSON file path and then opens/loads the data into a dictionary, which is the output of the function.create_question_obj
: The function takes the quiz data dictionary (output of the functionimport_data
), and returns the question objects that contain information for use during the quiz session.parse_quiz
: The main function that calls others for extracting the quiz data from the JSON file and creates a quiz object.
Module2: Creates quiz objects
- Defines quiz properties such as questions, answers
- Enables to take the quiz
- Keeps track of the participant’s score
- Times the quiz duration for each participant
File: quiz.py
class Quiz
: contains all information for the quiz session, including questions, answers, and points.
Functions:
print_header
: The function takesidx
, which is the number of the question, and prints the header of each question.print_results
: The function takes a quiz to visualize the user's name for printing the user results.take_quiz
: The function runs the quiz session after the user selects the quiz to take.cal_score
: The function calculates the score of the quiz session. Calculating the score is divided into two parts: calculating the question's score and extra score, which is related to the user's time spending on each question. For the extra score, if the user answers correctly, they will get an extra 5 points for answering within 1 second. Otherwise, they will get the ratio of 5 over the time spent (in seconds). If they answer incorrectly, they will not get the extra score.
class Question
: stores all the question information for running the quiz session.
class QuestionTF
: stores the True or False question type. This object is used when the program is waiting for the user's answer.
Functions:
ask
: The function prints the True/False question information to the users and gets a response from them.
class QuestionMC
: stores the Multiple Choice question type. This object is used when the program is waiting for the user's answer.
Functions:
ask
: The function prints the Multiple Choice question information to the users and gets a response from them.
class Answer
: stores the answers of each question.
Overall, the package is a cohesive system for conducting quizzes efficiently, tracking performance, and managing quiz content.
Getting Started
To start using the Quiz App, follow these steps:
Prerequisites
- Ensure you have Python installed on your system. The application has been tested with Python 3.9 and higher.
Quiz App Installation and Usage Guide
There are two methods to install the Quiz App:
Method 1: Using pip
You can install the Quiz App directly using pip by running the following command:
pip install quizzerapp
Running the App
After installing through pip, you can run the application as a Python module from any location in your terminal or command prompt:
python -m Quizzer
Method 2: Cloning or Downloading the Repository
- Clone or download the Quiz App repository to your local machine.
- Navigate to the app directory in your terminal or command prompt.
Running the App
- Execute the application by running the following command:
python main.py
Using the Quiz App
Once the app is running, you will be greeted with a welcome message and prompted to enter your name.
Main Menu
The main menu offers the following options:
- List Quizzes (L): Displays a list of available quizzes.
- Take a Quiz (T): Allows you to select and take a quiz.
- Exit the App (E): Exits the application.
Taking a Quiz
- Select the option to take a quiz.
- Enter the quiz number you wish to attempt.
- Answer the questions as they appear.
- Upon completion, your results will be displayed.
Viewing Quiz Results
- After completing a quiz, your results are displayed on the screen, showing your score and the number of correct answers.
Troubleshooting
To test the Quizzer app, you can run the following code:
python3 unittest_main.py
This test conducts unit tests each of the four modules.
If you encounter any issues:
- Check that you are using a compatible Python version.
- Ensure the JSON files for quizzes are correctly formatted and located in the 'Quizzes' folder.
- Ensure the JSON files for quizzes are correctly formatted and located in the 'db_quizzes' folder.
- Review any error messages in the console for guidance.
Contributing
Contributions to the Quiz App are welcome. Please feel free to fork the repository, make changes, and submit pull requests.
License
Student names:
-
- Kulaphong Jitareerat, 67761544
-
- Nijiati Abulizi, 59764100
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file QuizzerApp-0.0.2.tar.gz
.
File metadata
- Download URL: QuizzerApp-0.0.2.tar.gz
- Upload date:
- Size: 21.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27deaed7d0d1f488efe75d913335801b5b74d8a99aa29760d5bad5118dd623d0 |
|
MD5 | e417d0ae87eb19c249629b280b732269 |
|
BLAKE2b-256 | e5c2ac4a1a16701c4855d3a0950d6a3927402131401767a492d68fc23ba863e0 |
File details
Details for the file QuizzerApp-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: QuizzerApp-0.0.2-py3-none-any.whl
- Upload date:
- Size: 25.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2555a39f0e8089d728e0e2f46855a90a8a0d0a2123480d10009c17e6e4599e14 |
|
MD5 | f7b5c1a6e85a447b1e340c1aa48a28b3 |
|
BLAKE2b-256 | 704146f887e7e6ee6e5863dda07d09e473cf472452b1431b37eabcd094ac60a5 |