Building useful clsses


#1

class Point3D(object):
def init(self,x,y,z):
self.x=x
self.y=y
self.z=z
def repr(self):
"(%d,%d,%d)"%(self.x,self.y,self.z)

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

the code above has some error it will not print anything. Can some one quickly check pls


#2

ok fixed one issue now it prints the output but still getting an error looks like u have not printed "(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.repr()strong text


#3

fixed it, it needed proper spacing in %d


#4