Challenge 1: Add a delete Command — Possible Solution ==================================================================== # added to the subparsers section: delete_parser = subparsers.add_parser("delete") delete_parser.add_argument("id", type=int) # added to the if/elif chain: elif args.command == "delete": tasks = [t for t in tasks if t.id != args.id] storage.save(tasks) print(f"Deleted task {args.id}") WHY THIS WORKS AS AN ANSWER ------------------------------ delete_parser = subparsers.add_parser("delete") followed by delete_parser.add_argument("id", type=int) reuses the chapter's own complete_parser setup exactly — same shape, same type=int conversion so args.id arrives as a real integer rather than a string, matching the id: int type hint on the Task dataclass itself. tasks = [t for t in tasks if t.id != args.id] reuses the list comprehension pattern from Course 1/Course 2's comprehension chapters to build a NEW list containing every task except the one matching args.id — filtering by exclusion rather than manually finding an index and calling .pop() or .remove(), which keeps the logic a single readable expression, following the same list-filtering style already used throughout this chapter's own list handling. storage.save(tasks) reuses the exact same save() call from the add and complete branches — regardless of which command ran, the same TaskStorage.save() method persists whatever the current in-memory tasks list looks like back to disk, keeping all three commands consistent in how they commit changes. Reassigning the tasks variable directly (rather than mutating it in place) works correctly here because tasks was loaded fresh via storage.load() earlier in main() and isn't referenced anywhere else in the function — there's no aliasing concern like the one Course 2, Chapter 1's mutable-class-attribute warning described.