Building useful classes


#1



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


Oops, try again. It looks like you didn't print "(1, 2, 3)".


class Point3D(object):
    def __init__(self, x, y, z):
        self.x = x
        self.y = y
        self.z = z
    def __repr__(self):
        return "(%d %d %d)" % (self.x, self.y, self.z)

my_point = Point3D(1, 2, 3)
print my_point


#2

Looks right to me unless I'm missing something. Try refreshing the page?


#3

I refreshed the page and it still didn't work.


#4

Oh, you're missing a comma in your return between the numbers.


#5

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