Constructors Topic

class Point:
def init(self, x, y):
self.x = x
self.y = y

def draw(self):
    print(f"Point ({self.x}, {self.y})")

point = Point(1, 2)

When I run this code it should give me a result as Point (1, 2). For some reason I am getting the below error.

SyntaxError: invalid syntax

Any help please?

It looks like you’re using a rather old (prior to 3.6) version of python. Run python --version to be sure.

1 Like

Hi @SAM Thank you so much. That was super simply.

I went to the settings.json file, changed this line “python”: “python -u”,

“python”: “python3 -u”,

And it worked.