what is the error of this code [closed]

0
class Point3D(object):
    def _init_(self,x,y,z):
     a=str(x) 
     self.x=a
     a=str                    
asked by anonymous 19.07.2016 / 05:21

1 answer

2

Study the done article, and try to improve the question - but looking at the code, even without knowing the message you see, the wrong thing is that the _init_ method should be __init__ (with two underscores the prefix and in the suffix) - to have the effect that you probably intend: that is, it is automatically called by the language when the Point3D class is instantiated.

It is a language convention, all methods that will be called by internal language mechanisms are surrounded by two sublinohdos __ on each side.

    
19.07.2016 / 14:12