Sequence Diagram
A sequence diagram shows who calls whom and in what order. Participants have vertical lifelines. Time advances downward; solid arrows show calls and dashed arrows show returns. An alt frame separates alternative paths.
The Controller asks the Student to enroll. The model either raises ValueError or creates a link and appends it to both enrollment lists. The Controller passes the result to the View for formatting.
The note in the success branch records the two actual list updates: ada._enrollments.append(enr1) and cs101._enrollments.append(enr1). We show the lists in this note to keep the diagram narrow; these are operations on the stored lists, not additional Student or Course methods. The duplicate branch performs neither update. The returned Enrollment is not a second newly created enrollment.
Controller and View name responsibilities in this diagram; the MVC lesson implements them as functions rather than classes. Its View returns a formatted message to the Controller, which returns it to the calling program outside this diagram. Trace either the duplicate branch or the success branch, not both in one call.
Check it: why must the duplicate path avoid both append calls?
These interactions also suggest how to divide the code into modules with clear responsibilities.