School catalog for Machine Learning

I’m working on the school catalog project in the Machine Learning/AI Engineer course.

I’m stuck on steps 15 and 16. Step 15 asks you to create a high school class inherited from the original school class. It then asks you to Create a constructor that accepts arguments for name , numberOfStudents , and sportsTeams

Step 16 asks you to test the code to make sure it works correctly. It says to create a High School object and verify your new constructor, getter method, and __repr__() method work as expected.

My code is below:

class HighSchool(School):
def init(self, numberOfStudents, sportsTeams):
super().init(name, ‘High’, numberOfStudents)
self.sportsTeams = sportsTeams
def get_sportsTeams(self):
return self.sportsTeams.append(list)
def repr(self):
sportFun = super().repr()
return sportFun + " The school’s sports are {sportsTeams}".format(sportsTeams = self.sportsTeams)
g = HighSchool(‘Dunbar’, 650, [‘Baseball’, ‘Rugby’])

I keep getting a message saying:

Traceback (most recent call last):
File “”, line 45, in
g = HighSchool(‘Dunbar’, 650, [‘Baseball’, ‘Rugby’])
TypeError: init() takes 3 positional arguments but 4 were given

How do I get the function to take 4 positional arguments?


def __init__(self, numberOfStudents, sportsTeams):

is your constructor to your class.
It takes 3 arguments because that’s what you defined it as. Those three are self, numberOfStudents and sportsTeams.

If you want more just add more. It looks like it’s missing name.

Got it now. Thanks. It’s working now.