Building useful clesses (It looks you didn't print)- SOLVED


#1

What is wrong with my code?



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


<


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

The spacing in the output should be exactly as specified in the instructions.


#3

Solution was change the format of the string would return in the representation method
Format is (x, y, z) so need a space here in "(%d, %d, %d)"

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

#4