import traceback #countingsort: takes as input a list of Student objects, and #a
ID: 3756504 • Letter: I
Question
import traceback #countingsort: takes as input a list of Student objects, and #a character houseOrYear, which is 'h' If we are sorting the #students by house, or 'y' if sorting by year #Returns a list of Student objects, which is sorted by the #appropriate attribute. def CountingSort (studentList, houseOrYear): #TODO: Implement Counting Sort here. return [) #DO NOT EDIT BELOW THIS LINE #sortstudents function. Takes as input a list of Student objects, #sorted alphabetically by name, and outputs a list of Student objects, #sorted by the following priority: house, then year, then name def SortStudents (studentList): yearsorted = CountingSort (studentList, 'y') houseSortedCountingSort (yearSorted, 'h') return houseSorted #student class #Each task has three instance variables: # self.name is a string representing the name of the student # self.house is a string representing whichExplanation / Answer
def getKeyHouse(student):
return student.house;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.