11/11 building useful classes


this is my code 

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

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)".


I do not know if you have solved this yet, but try putting spaces before where the 2 and 3 will appear in:
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


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


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


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


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