11/11 building useful classes


#1



this is my code 

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

and i have this problem. How can i solve it 


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


#2

I do not know if you have solved this yet, but try putting spaces before where the 2 and 3 will appear in:
(1,2,3)
Also, place "(" ")" around "(%d,%d,%d)"
Your end result should look like this.
return ("(%d, %d, %d)")...
I got most of this information from a separate post: https://discuss.codecademy.com/t/11-building-useful-classes/48121

Hope this works


#3

I have the same problem. Couldn't fix it with any of the suggested steps yet.


#4

Ok, it was the spaces... It should be "(%d, %d, %d)" instead of "(%d,%d,%d)" in order to work.


#5

Please pay attention to the blank space between x,y,z. The ritht print out should be (x, y, z),not (x,y,z)


#6

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