Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions