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 07:30
By refraining from constructing a building until they are certain that it will not cause harm to the environment, an organization is adhering to the
Answers: 2
question
Computers and Technology, 23.06.2019 01:20
Me with this program in c++ ! computers represent color by combining sub-colors red, green, and blue (rgb). each sub-color's value can range from 0 to 255. thus (255, 0, 0) is bright red. (130, 0, 130) is a medium purple. (0, 0, 0) is black, (255, 255, 255) is white, and (40, 40, 40) is a dark gray. (130, 50, 130) is a faded purple, due to the (50, 50, 50) gray part. (in other word, equal amounts of red, green, blue yield gray).given values for red, green, and blue, remove the gray part. ex: if the input is 130 50 130, the output is: 80 0 80. thus, find the smallest value, and then subtract it from all three values, thus removing the gray.
Answers: 3
question
Computers and Technology, 23.06.2019 10:00
Install and use wireshark program ( send back screen shots and other vital information) case project 3-2: decode a tcp segment in a wireshark capture in this chapter, you walked through tcp segment to interpret the data included in its header. in this project, you use wireshark to capture your own http messafes, examine the tcp headers, and practice interpreting the data you'll find there. 1. open wireshark and snap the window to one side of your screen. open a browser and snap that window to the other side of your screen so you can see both windows.
Answers: 2
question
Computers and Technology, 23.06.2019 13:00
Which of the following statements is false? a. a class can directly inherit from class object. b. if the class you're inheriting from declares instance variables as private, the inherited class can access those instance variables directly. c. a class's instance variables are normally declared private to enforce good software engineering. d. it's often much more efficient to create a class by inheriting from a similar class than to create the class by writing every line of code the new class requires.
Answers: 3
You know the right answer?
Add three methods to the student class that compare twostudent objects. one method ) should test for...
Questions
question
Mathematics, 25.10.2021 07:40
question
Mathematics, 25.10.2021 07:40
question
Physics, 25.10.2021 07:40
question
History, 25.10.2021 07:40
question
Mathematics, 25.10.2021 07:40
question
Mathematics, 25.10.2021 07:40
Questions on the website: 13722361