Classes_Building useful classes


#1

Error:
Oops, try again. Make sure you define your own repr() for the Point3D class.

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

__repr__() You mean?
not repr(self) ?


#3

oh so silly. Thanks @greentreemee !!! :wink:


#4

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