Syntax error

class School():

def init(self, name, level, numberOfStudents):

self.name = name

self.level = level

self.numberOfStudents = numberOfStudents

#getters

def get_name(self):

return self.name

def get_level(self):

return self.level

def get_numberOfStudents(self):

return self.numberOfStudents      

   #setters

def set_numberOfStudents(self, no):

self.numberOfStudents = no

def repr(self):

return ("A {} school named {} with {} students".format(self.level, self.name, str(self.numberOfStudents))

_______________ class school___________

a = School(“aa”, “bb”, 10)

a.set_numberOfStudents(200)

print(a)

class PrimarySchool(School):

pass

Python is showing invalid intax at
class PrimarySchool(School):
^
SyntaxError: invalid syntax
but I dont get what is wrong in it

If you’re catching syntax errors on line you think are valid then check preceding lines for things that might not have been properly closed, e.g. parentheses.

1 Like