H2K Infosys Forum

AI Assistant
What is the purpose...
 
Notifications
Clear all

What is the purpose of the __init__() method in Python classes?

 
Member Moderator
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

__init__() initializes an object’s attributes when the object is created. It acts like a constructor and is a fundamental concept taught in certificate python programming courses because it helps learners understand how objects are set up internally.

 
class Car:
def __init__(self, brand):
self.brand = brand

Quote
Topic starter Posted : 19/11/2025 5:39 am
Share: