223.3 Creating initial class files with stubs
The initial class files are created with method stubs to establish structure before implementation begins.
Method stubs
Why use them?
task.py
class Task:
"""
Represents a task with a title, description, due date, and completion status.
"""
def __init__(self, title, description, due_date):
self.title = title
self.description = description
self.due_date = due_date
self.completed = False
def mark_complete(self):
"""Marks the task as complete."""
pass
def mark_incomplete(self):
"""Marks the task as incomplete."""
pass
def display_summary(self):
"""Prints a one-line summary of the task."""
pass
def display_details(self):
"""Prints the full details of the task."""
passtask_manager.py
Last updated
Was this helpful?