Syntax Error?


#1



https://www.codecademy.com/courses/python-intermediate-en-egNXj/1/5?curriculum_id=4f89dab3d788890003000096#


My code gave the error message:
File "python", line 2
init(self, x, y, z):
^
SyntaxError: invalid syntax


It's not showing it in the pasted error message, but the init does have the underscores around it, and the "^" is pointing to the colon. Couldn't find anything on Stack Overflow, so I came here and posted it.


class Point3D(object):
    __init__(self, x, y, z):
        self.x = x
        self.y = y
        self.z = z
    __repr__(self):
        return "(%d, %d, %d)" % (self.x, self.y, self.z)
my_point = Point3D(1, 2, 3)
print my_point


#2

The error is before __init__. What does that tell you? See anything missing?


#3

Yes. This was definitely the worst forum question I've ever asked. Thank you.


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.