def __init__(self): is the initializer method used to create instances (objects) of a Python class. It's in this constructor method that default values or arguments get set as attributes on the instance of the class (the self object).
class Student(object):
def __init__(self, name):
self.name = name # sets the name attribute on a Student object when created
data_student = Student('Tico')
print(data_student.name) # prints "Tico"
def __init__(self):
is the initializer method used to create instances (objects) of a Python class. It's in this constructor method that default values or arguments get set as attributes on the instance of the class (theself
object).