Skip to main content

Checkpoint: The Data Model

advanced35 min readLesson 111 of 169

Implement a protocol-complete, slotted linked list β€” the module's skills in one object.

Checkpoint β€” build a protocol-complete linked list

No starter code beyond the class shells. Requirements:

  • LinkedList(items=()) builds from any iterable
  • len(), iteration (headβ†’tail), x in list, repr as LinkedList(1 -> 2 -> 3)
  • indexing: l[i] with negative indexes supported; l[1:3] returns a new LinkedList (support a step too)
  • prepend(x) is O(1); reverse() returns a new list, original untouched
  • both classes use __slots__ β€” no __dict__ on instances

Grading runs the full protocol battery against your implementation, plus a plausible-but-wrong variant to make sure the tests bite.