Question: the original class definition is: class Gradebook: def __init__(self, course_name, records): Required arguments: course_name: a string that represents the course name records: a dictionary

 the original class definition is: class Gradebook: def __init__(self, course_name, records):

the original class definition is:

class Gradebook:

def __init__(self, course_name, records): """ Required arguments: course_name: a string that represents the course name records: a dictionary with each entry representing a student score pair """ self.records = {} self.course_name = course_name self.records.update(records)

def remove(self, student): del self.records[student]

def __repr__(self): text="" for a, b in self.records.items(): text=text+f"{a} -> {b} " return text

def update(self, student, score): if student in self.records: print(f"{student}'s score has been updated from {self.records[student]} to {score}!") self.records[student]=score else: self.records[student]=score print(f"A new record ({student} -> {score}) is added!")

Define 3 more methods _str___self), sort(self), and average(self) for the Gradebook class with the following effects: gradebook1 = Gradebook('Python Programming', \{'Troy': 92, 'Calvin': 95, 'James': 89, 'Charles': 100, 'Bryn': 59, 'Alice': 95\}) gradebook1 Troy ->92 Calvin >95 James >8 Charles 100 Bryn 59 Alice >95

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!