An package able to make a quiz.
Project description
Quiz Python Package Description
Group members: Zetian Zhao(skywalker007-cpu), Haoxiang Xu
Table of Contents
Description
The Quiz Python package is a package that allows users to create quizzes and take them. The package includes three classes: Quiz, Question, and Response. The Quiz class is the main class of the package and is used to create a quiz object. The Question class represents a question in the quiz, and the Response class represents a response from a student to a question in the quiz. The package also includes three subclasses of the Question class: MultipleChoiceQuestion, ShortAnswerQuestion, and TrueFalseQuestion.
Installation
To install the Quizzing package, you can use the following command:
pip install git+
Usage
-
Import the Quizzing package:
from quizzing import Quizzing
-
Create a quiz object:
quiz = Quiz() # OR quiz = Quiz(questions, responses, API_KEY)
questionsOptional (List[Question]): A dictionary ofQuestionobjects that represent the questions in the quiz.responsesOptional (List[Response]): A dictionary ofResponseobjects that represent the responses to the quiz.API_KEYOptional (str): The API key used to access the OpenAI API for marking the responses.
List of Classes
Quiz
- Description: This class is the main class of the package. It is used to create a quiz object. The class has a list of
Questionobjects and a dictionary ofResponseobjects. The class also has a method to take the quiz and submit responses, and a method to mark the quiz using the OpenAI API.
Included Variables
questions: A nested dictionary ofQuestionobjects that each key-value pair represent the question ID and the question object.responses: A dictionary ofResponseobjects that each key-value pair represent the student ID and their response to the quiz.API_KEY(str): The API key used to access the OpenAI API for marking the responses.
Included Methods
__init__(self, questions: List[Question], responses: dict[str, Response], API_KEY: str): The constructor method for theQuizclass. It initializes thequestions,responses, andAPI_KEYvariables.__str__(self): A method that returns a string that list the questions.add_question(self, question: Question): A method that adds aQuestionobject to thequestionslist. (unable to add a question if the quiz has already started, and will show "quiz is already started, and you cannot add question anymore!" to the user for notification.)remove_question(self, question: Question): A method that removes aQuestionobject from thequestionslist. (unable to add a question if the quiz has already started, and will return corresponding string for notification.)add_response(self, response: Response): A method that adds aResponseobject after user reply to the question during the quiz to theresponseslist. (unable to add a response if there is no quiz happening, and will return corresponding string for notification.)take_quiz(self, student_id): A method that allows the user to take the quiz and submit responses. (unable to take the quiz if there's no questions, and will return corresponding string for notification.)mark_quiz(self, student_id, type): A method that marks the quiz using the OpenAI API and returns the results (format - gained score/total score). (unable to mark the quiz if the quiz has not been taken, and will return corresponding string for notification.)type: auto(AI) or manual(human)
Question
- Description: This class represents a question in the quiz, and data format is following a dictionary format, which the values are question id, question text, correct answer, score, and type of the question with corresponding key.
Included Variables
question_id: The ID of the question.description: The text of the question.answer: The correct answer to the question.score: The score of the question.
Included Methods
__init__(self, question: str, score: int): The constructor method for theQuestionclass. It initializes thequestionandscorevariables.__str__(self): A method that returns a string representation of the question.
SubClasses (extend from Question)
MultipleChoiceQuestion: A subclass ofQuestionthat represents a multiple-choice question, and has an additionaloptionsvariable.- extra attribute:
optionsin the__init__function: A list of options for the multiple-choice question.
- extra attribute:
ShortAnswerQuestion: A subclass ofQuestionthat represents a short answer question.- extra attribute:
noticein the__init__function: A notice for user when they do the short answer question. For example, "Please write your answer in one sentence."
- extra attribute:
TrueFalseQuestion: A subclass ofQuestionthat represents a true/false question.- extra attribute:
optionsin the__init__function: A list of options that only contain true/false.
- extra attribute:
Response
- Description: This class represents a response from a student to a question in the quiz.
Included Variable
student_id: The ID of the student who submitted the response.response: a JSON format object that contains the student's response to the question.
Included Methods
__init__(self, student_id: str, response: List[str]): The constructor method for theResponseclass. It initializes thestudent_idandresponsevariables.__str__(self): A method that returns a string representation of the response.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file quizzingpackage-0.0.1.tar.gz.
File metadata
- Download URL: quizzingpackage-0.0.1.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
63b1c1fe41f78b033dd66b131ebf8ce00dbfb4cb05359207ecafb414854bad4a
|
|
| MD5 |
eafbc2857803ddea4bac762ca38d33f4
|
|
| BLAKE2b-256 |
5f0fdaee402326321468794118620ec1394fa9bde766d53ce76b603f6cddc557
|
File details
Details for the file QuizzingPackage-0.0.1-py3-none-any.whl.
File metadata
- Download URL: QuizzingPackage-0.0.1-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba00f07246d29a21a82bf67d06efb657b772e29f3d45e86068c6cd423753bc90
|
|
| MD5 |
a17f72a6b1c3fe48963c750d961522fa
|
|
| BLAKE2b-256 |
8e9eaec237dc0b5b5399a958b09b673dbe9fe200426377a9e9e72a53f18ba1cd
|