- 3
What is used to create instance of class
that is __init__() method
1 Antwort
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