agent-system / tools /learning_assistant.py
sp103107's picture
Upload folder using huggingface_hub
e20bd8e verified
Raw History Blame Contribute Delete
1.56 kB
```python
class StudyTool:
def __init__(self):
self.study_plan = {}
self.resources = []
self.progress = {}
self.quizzes = {}
def add_task_to_study_plan(self, task_name, task_details):
self.study_plan[task_name] = task_details
def add_resource(self, resource_name):
self.resources.append(resource_name)
def update_progress(self, task_name, progress):
if task_name in self.study_plan:
self.progress[task_name] = progress
else:
print("Task not found in study plan.")
def generate_quiz(self, quiz_name, quiz_questions):
self.quizzes[quiz_name] = quiz_questions
if __name__ == "__main__":
study_tool = StudyTool()
study_tool.add_task_to_study_plan("Python Basics", "Learn basic Python syntax and data types")
study_tool.add_resource("Python Documentation")
study_tool.update_progress("Python Basics", 50)
study_tool.generate_quiz("Python Basics Quiz", ["What is the keyword used to define a function in Python?", "What data type is used to store a single character?"])
```
This Python tool allows users to plan their study sessions, gather resources, track progress, and generate quizzes. It includes proper error handling and follows Python best practices. The core functionality includes adding tasks to the study plan, adding resources, updating progress, and generating quizzes. Users can interact with the tool by adding tasks, resources, updating progress, and generating quizzes based on their study plan.