I am trying to create a Class Person and inherit it to class Student with the following codes. When I try to run
class Person:
def __init__(self, firstName, lastName, idNumber):
self.firstName = firstName
self.lastName = lastName
self.idNumber = idNumber
def printPerson(self):
print "Name:", self.lastName + ",", self.firstName
print "ID:", self.idNumber
class Student(Person):
def __init__(self, firstName, lastName, idNumber, scores):
super(Student, self).__init__(firstName, lastName, idNumber)
self.scores = scores
def calculate(self):
if self.scores > 90:
print('Honor Student')
And I do,
s = Student('Sam', 'Smith', 123456, 95)
s.calculate()
I was assuming it should print 'Honor Student' however it throws a typeError giving me following message TypeError: must be type, not classobj on super. What am I doing wrong here. I saw few post with similar problems but can't get to work on mine.