11/11 Building useful classes


#1

I can't understand why it keeps giving me the this error--> Oops, try again. Make sure you've defined a new Point3D class.

class Point3d(object):
def init(self, x, y, z):
self.x = x
self.y = y
self.z = z

def __repr__(self):
    "(%s, %s, %s)" % (str(self.x), str(self.y), str(self.z))

my_point = Point3d(1, 2, 3)

print my_point


#2

Hi, @jbl1234567 ,

Because your code is not formatted, it is difficult for other users to read and debug it. As code is being posted, you can format it by selecting it, and then by clicking the </> button above the editing area. This will enable us to see important details, such as the indentation and underscores.

Do you have an __init__ method within the function definition? Your posted code contains one that is instead named init, and it is not clear whether it is indented, as it should be.


#3

You forgot the command STR inside function repr and replace name of class
The correct is Point3D and not Point3d