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 04:00
Chloe is building a kiosk-based excel application. she wants to make some modifications to the screen elements in order to keep users from being distracted by parts of the application that are irrelevant to her application. she turns to henry for guidance as she knows he built a similar solution earlier this year.chloe has decided to hide the worksheet gridlines and the vertical scroll bar. what does henry tell her to use to do this? a) screen elements dialog boxb) display options dialog boxc) customization dialog boxd) excel options dialog box
Answers: 2
question
Computers and Technology, 22.06.2019 18:30
Which of the following is an example of intellectual properly! oa. new version of a novelb. journal of ideasc. pages of a bookood. lines of a poem
Answers: 2
question
Computers and Technology, 23.06.2019 07:50
Most shops require the technician to enter a starting and ending time on the repair order to track the actual time the vehicle was in the shop and closed out by the office. this time is referred to as _ time ? a. comeback b. ro c. cycle d. lead
Answers: 1
question
Computers and Technology, 23.06.2019 14:30
Select the correct answer. sean is a computer programmer. he has programmed an application for toddlers that plays nursery rhymes. however, a logic error has occurred in the program. which problem is a likely consequence of the error? a. the program crashes every time the user wants to play the nursery rhymes. b. the program crosses its buffer boundaries and overwrites an adjacent program. c. the program plays a different nursery rhyme than the one the user intended to play. d. the program shows different structures in its programming language code. e. the program introduces new viruses every time the user plays a nursery rhyme.
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
Mathematics, 26.12.2019 15:31
question
Mathematics, 26.12.2019 15:31
question
Social Studies, 26.12.2019 15:31
Questions on the website: 13722362