Building useful classes


#1

Hello good fellas I am getting an error her and i tried str() but it can't accept more than 1 variable what's the catch?

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

Where is the catch


#2

the output should be:

(1, 2, 3)

your output:

(1,2,3)

see the differences? spaces vs no spaces


#3

Well LOL :smiley:

Thank you Master


#4