MACHINE LEARNING

APPLICATION OF SUPERVISED LEARNING

PERCEPTRON

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
What is the ____ init ____() method for when creating a class in python?
A
this is a constructor, it creates new objects with given attributes
B
this is a constructor, it creates a class
C
this is a destructor, it removes class objects
D
it is an initializer, it initializes class objects
Explanation: 

Detailed explanation-1: -The init method is the Python equivalent of the C++ constructor in an object-oriented approach. The init function is called every time an object is created from a class. The init method lets the class initialize the object’s attributes and serves no other purpose. It is only used within classes.

Detailed explanation-2: -” init ‘’ is a reseved method in python classes. It is called as a constructor in object oriented terminology.

Detailed explanation-3: -The python init method is declared within a class and is used to initialize the attributes of an object as soon as the object is formed. While giving the definition for an init (self) method, a default parameter, named ‘self’ is always passed in its argument. This self represents the object of the class itself.

There is 1 question to complete.