subject
Computers and Technology, 11.12.2019 20:31 cache77

Add three methods to the student class that compare twostudent 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 students’ names. include a main function that tests all of the comparison operators.
current code is below:
"""
file: student. py
resources to manage a student's name and test scores.
"""
class student(object):
"""represents a student."""
def , name, number):
"""all scores are initially 0."""
self. name = name
self. scores = []
for count in range(number):
self. scores. append(0)
def getname(self):
"""returns the student's name."""
return self. name

def setscore(self, i, score):
"""resets the ith score, counting from 1."""
self. scores[i - 1] = score
def getscore(self, i):
"""returns the ith score, counting from 1."""
return self. scores[i - 1]

def getaverage(self):
"""returns the average score."""
return sum(self. scores) / len(self._scores)

def gethighscore(self):
"""returns the highest score."""
return max(self. scores)

def ):
"""returns the string representation of the student."""
return "name: " + self. name + "\nscores: " + \
" ".join(map(str, self. scores))

# write method definitions here
def main():
"""a simple test."""
student = student("ken", 5)
print(student)
for i in range(1, 6):
student. setscore(i, 100)
print(student)
if __name__ == "__main__":
main()

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 08:30
Linda subscribes to a cloud service. the service provider hosts the cloud infrastructure and delivers computing resources over the internet.what cloud model is linda using
Answers: 1
question
Computers and Technology, 24.06.2019 07:00
Into what form does the barcode reader convert individual bar patterns?
Answers: 1
question
Computers and Technology, 24.06.2019 13:00
Refer to the figure and match the theorem that supports the statement.1.if chords are =, then arcs are =.if bc = de, then arc bc = arc de2.if arcs are =, then chords are =.if arc bc = arc de, then bc = de3.diameters perpen
Answers: 3
question
Computers and Technology, 24.06.2019 13:30
Does anybody know how to hack into a google account? i had important information on it and it is gone now and i need getting it back.
Answers: 1
You know the right answer?
Add three methods to the student class that compare twostudent objects. one method ) should test for...
Questions
question
Chemistry, 05.11.2020 19:10
question
Mathematics, 05.11.2020 19:10
question
Mathematics, 05.11.2020 19:10
question
Mathematics, 05.11.2020 19:10
question
Social Studies, 05.11.2020 19:10