Inheritance

  • + 0 comments
    class Student(Person):
        #   Class Constructor
            def __init__(self, firstName, lastName, idNum, scores):
                self.firstName = firstName
                self.lastName = lastName
                self.idNumber = idNum
                self.scores = scores
        #
            def calculate(self):
                avg = sum(self.scores) / len(self.scores)
                if ((90<=avg) and (avg<=100)):
                    return str("O")
                elif ((80<=avg) and (avg<90)):
                    return str("E")
                elif ((70<=avg) and (avg<80)):
                    return str("A")
                elif ((55<=avg) and (avg<70)):
                    return str("P")
                elif ((40<=avg) and (avg<55)):
                    return str("D")
                else:
                    return str("T")