Building Useful Classes - too many arguments?


#1

Error:
Traceback (most recent call last):
File "python", line 10, in
TypeError: Point3D() takes exactly 1 argument (3 given)

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

Not sure why my Point3D class is only accepting 1 argument when I've defined 3 in addition to "self". Plus my code looks like everyone elses....


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

print my_point


#2

Hi @ashleyz413,

Here, you should be defining a class rather than a function ...

def Point3D(object):

It should be ...

class Point3D(object):

In this method header, you need to include a self parameter within the parentheses ...

    def __repr__():

#3

Thank you, think I was just staring at it too long......


#4