What is used to create instance of class | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 3

What is used to create instance of class

that is __init__() method

24th Aug 2018, 6:49 PM
Umesh Langade
Umesh Langade - avatar
1 Answer
0
The __init__ method is what is called when you create (instantiate) an instance of a class. You usually take in arguments for the instance and set the initial properties of your object here. For example: class Car(): def __init__(self, x, y): self.x = x self.y = y self.speed = 0
24th Aug 2018, 10:52 PM
Just A Rather Ridiculously Long Username