Question: Add three methods to the Student class that compare two Student objects. One method should test for equality. A second method should test for less
Add three methods to the Student class that compare two Student objects. One method should test for equality. A second method should test for less than. The third method should test for greater than or equal to In each case, the method returns the result of the comparison of the two stuclass Studentobject:
Represents a student."""
def initself name, number:
All scores are initially
self.name name
self.scores
for count in rangenumber:
self.scores.append
def getNameself:
Returns the student's name."""
return self.name
def setScoreself i score:
Resets the ith score, counting from
self.scoresi score
def getScoreself i:
Returns the ith score, counting from
return self.scoresi
def getAverageself:
Returns the average score."""
return sumselfscores lenselfscores
def getHighScoreself:
Returns the highest score."""
return maxselfscores
def strself:
Returns the string representation of the student."""
return "Name: self.name
Scores:
joinmapstr self.scores def main:
A simple test."""
student StudentKen
printstudent
for i in range:
student.setScorei
printstudent
if namemain:
main
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
