promptdojo_

@dataclass — the class shape AI ships in every modern Python project — step 8 of 9

Write a Task dataclass with three fields:

  • title: str (required)
  • priority: int with default 1
  • tags: list with field(default_factory=list)

Use the @dataclass decorator. Don't write __init__ by hand — let the decorator generate it.

Then create two tasks, append a tag to one of them, and print both to verify the lists are independent.

Expected output:

Task(title='ship', priority=1, tags=['urgent'])
Task(title='clean inbox', priority=3, tags=[])

full-screen editor opens — close anytime to keep reading.