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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 02:30, chaaaa
People with high self-esteem: accept their strengths and weaknesses. believe that failed experiences are failures of their whole self. feel good about who they are only when they reach total success. need positive external experiences to counteract negative feelings that constantly plague them.
Answers: 1
image
Computers and Technology, 24.06.2019 08:00, ineemorehelp
Arah has entered data about football players from team a and team b in a worksheet. she enters names of players from team a with details about each player in different columns of the worksheet. similarly, she enters details of all the players from team b. which option will her view the data for team a and team b in two separate sections after printing? a. page break view b. freeze pane view c. split screen view d. full screen view e. zoom out view
Answers: 1
image
Computers and Technology, 24.06.2019 11:00, soystersoce
Under the home tab, where can a user find options to change the bullet style of an outline? in the slides group in the font group in the paragraph group in the drawing group
Answers: 1
image
Computers and Technology, 24.06.2019 22:00, dixks
According to your study unit, what is the main reason that improved human relations skills may improve your grades?
Answers: 1
You know the right answer?
Add three methods to the student class that compare twostudent objects. one method ) should test for...

Questions in other subjects:

Konu
History, 18.03.2021 19:00
Konu
Biology, 18.03.2021 19:00
Konu
History, 18.03.2021 19:00