classes and object-oriented programming figure contains class that can be used to keep track of the grades of collection of students instances of class grades are implemented using list and dictionary the list keeps track of the students in the class the dictionary maps student' identification number to list of grades notice that getgrades returns copy of the list of grades associated with studentand getstudents returns copy of the list of students the computational cost of copying the lists could have been avoided by simply returning the instance variables themselves doing sohoweveris likely to lead to problems consider the code allstudents course getstudents(allstudents extend(course getstudents()if getstudents returned self studentsthe second line of code would have the (probably unexpectedside effect of changing the set of students in course the instance variable issorted is used to keep track of whether or not the list of students has been sorted since the last time student was added to it this allows the implementation of getstudents to avoid sorting an already sorted list figure contains function that uses class grades to produce grade report for some students taking the mit course for which this book was developed