Question: class Course: A University Course === Public Attributes === name: the name of the course students: a list of students enrolled in the course
class Course: """ A University Course
=== Public Attributes === name: the name of the course students: a list of students enrolled in the course
=== Representation Invariants === - No two students in this course have the same id - name is not the empty string """
name: str students: List[Student]
def __init__(self, name: str) -> None: """ Initialize a course with the name of
def enroll_students(self, students: List[Student]) -> None: """ Enroll all students in
If adding any student would violate a representation invariant, do not add any of the students in
I just wanna know what does 'violate a representation invariant' mean?(using Python 3.8 for this question) How should I construct my code in the method "enroll_students"? Thank you.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
