What does the __ init__ function do in python?
Answer / Jai Prakash
__init__ is a special method in Python classes that gets called automatically when an object is instantiated (created). It's used to initialize the state of the object. Any code you put inside the __init__ method will be executed when you call the class with the constructors syntax.nnFor example:nnclass MyClass:n def __init__(self, name):n self.name = name
| Is This Answer Correct ? | 0 Yes | 0 No |
Why are tuples immutable?
What causes static?
Are methods objects in python?
What is means by string python?
Which software is used for python?
Give an example of a shuffle() method?
Is it possible to inherit one class from another class?
Give one example for multiple statements in single statement?
What are python iterators?
What is setup py?
Can you count to zero?
How can you pick a random item from a list or tuple in python?