59. Task CRUD Operations
CRUD = Create, Read, Update, Delete. These are the basic operations for managing tasks.
Example Task Representation
task = {"id": 1, "title": "Buy milk", "done": False}
Adding a Task
tasks = []
def add_task(title):
task = {"id": len(tasks)+1, "title": title, "done": False}
tasks.append(task)
Listing Tasks
def list_tasks():
for task in tasks:
status = "✓" if task["done"] else " "
print(f"[{status}] {task['id']}. {task['title']}")
Wrap-Up
CRUD operations form the foundation of the Task Manager.