Computers and Technology, 06.05.2020 03:01 chris159128
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 __init__(self, 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 __str__(self):
"""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()
Answers: 1
Computers and Technology, 22.06.2019 11:00
How does a policy manual an organization? a. it boost productivity. b. it create awareness in employees about the organization’s values. c. it employees achieve targets. d. it safeguards the organization from liabilities.
Answers: 1
Computers and Technology, 22.06.2019 18:00
Budgets you to do all of the following expect a) send frivolously b) avoid over spending c) gain financial independence d) examine your priorities and goals
Answers: 2
Computers and Technology, 23.06.2019 07:30
What key should you press and hold to select and open multiple files at one time? enter alt control esc
Answers: 1
Computers and Technology, 23.06.2019 19:30
Amitha writes up a one-page summary of a novel during her summer internship at a publishing company. when she reads over the page, she realizes she used the word “foreshadow” seven times, and she would like to reduce the repetition. which tool would best amitha solve this problem?
Answers: 3
Add three methods to the Student class that compare twoStudent objects. One method should test for e...
Chemistry, 11.12.2019 19:31
History, 11.12.2019 19:31
Geography, 11.12.2019 19:31
History, 11.12.2019 19:31
Mathematics, 11.12.2019 19:31
Advanced Placement (AP), 11.12.2019 19:31
History, 11.12.2019 19:31
Mathematics, 11.12.2019 19:31