Answered step by step
Verified Expert Solution
Question
1 Approved Answer
this question is in python I have posted the student class below and the screenshot below that is the A1.py functions this is what the
this question is in python I have posted the student class below and the screenshot below that is the A1.py functions
this is what the list looks like:
In the file Al.py, you are required to complete three methods for manipulating and working with a student class list. Complete the function sort_classlist_by_id_ascending which takes a parameter list of students and sorts the list of students in place with respect to their id in ascending order. You may not use the built in Python functions for sorting, but instead choose any of the sorting methods that we have developed in the lecture and the lab, and adapt them for this case. Complete the function search_classlist_by_id which searches a sorted list of students (sorted by student id) and returns the index of the searched for id. The function should return -1 if the searched for id is not contained in the student list. Note that you have to implement binary search to make this method efficient. Complete the function sort_classlist_by_total_marks_descending which takes a parameter list of students and sorts the list of students in place with respect to their combined (summed up) marks for all available assessments in descending order. This allows us to rank students according to their performance starting with the best student(s). You may not use the built in Python functions for sorting, but instead choose one of the sorting methods we have developed in the lecture and the lab. Note that if two students have the same total marks for the assessments, then the sorting should not affect the original order of the list of students. We call this a stable sort, and you have to choose the right sorting algorithm, since not all of our algorithms from the lecture are stable! . class Student: #works perfectly definitself.ename, id, email): self._name = name self._id = id self._email = email self._marks = [] #accessor def get_name(self): return self._name def get_email(self): return self._email def get_id(self): return self._id defget_marks(self): return self._marks #mutator def set_name(self.im name); self._name = name def set_email(self, email): self._email = email def set_id' self id): self._id = id def append_marks(self marks): self. __marks.append(marks) def get_sum_of_marks(self): return sum(self. __marks) def str. (self): return "{}: {}, {}, marks: {}, sum of marks: {}".format(self._id, self._name, self._email, self._marks, self,get_sum_of_marks()) def sort_classlist_by_id_ascending(student_list): #for this one could you use selection sort or bubble sort or insertion sort pass def sort_classlist_by_total_marks_descending(student_list): # for this one could you use selection sort or bubble sort or insertion sort has to be a stable sort out of tthe three def search_classlist_by_id (student_list, search_id): #use binary search A1 x "/Users/hackle/PycharmProjects/Assignment one compsc130/venv/bin/python" "/Users/hackle/PycharmProjects/Assignment one ['John', 'N00000001', 'john@amail.com'] ['Kelly', 'N00000002', 'kelly@bmail.com'] ['Nicky', 'N00000003', 'nicky@cmail.com'] ['Sam', 'N00000004', 'sam@dmail.com'] ['Adam', 'N00000005', 'adam@amail.com'] ['Crystal', 'NO0000006', 'crystal@amail.com'] ['Adrian', 'N00000007', 'adrian@amail.com'] ['Ricky', 'N00000008', 'ricky@amail.com'] ['Eric', 'N00000009', 'eric@amail.com'] Process finished with exit code 0Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started