In: Computer Science
Students in an institute have their name, id, and total score (out of 100) recorded. You are required to write a Python class to represent the student. Your code should display “Pass” or “Fail”, where the pass-score is above 60. Write the constructor, and other required methods to complete your code. Test the class by creating two objects of the class, where one student fails and the other passes.
Thanks for the question, here is the simple class and test code
=========================================================================
class Student():
def __init__(self, name, id,
score):
self.name = name
self.id = id
self.total_score =
score
def isPass(self):
return
self.total_score > 60
def print_status(self):
if
self.isPass():
print('Pass')
else:
print('Fail')
def main():
paul = Student("Paul Hughes",
123, 78)
patt = Student("Patrick Moe",
123, 59)
paul.print_status()
patt.print_status()
main()