class def __init__(self)instance the main inbuilt method is __init__which creates an instance of class object for examplestr is class object (string class)but str('hello'or simply 'hello'creates an instancesof the str class instance attributes are created during initialization and their values may be different for different instances in contrastthe values of class attributes are the same for every instance the variable self in the initialization method refers to the current instance that is being created here is simple exampleexplaining how attributes are assigned class shire_person def __init__ (self ,name)initialization method self name name instance attribute self age instance attribute address 'the shire class attribute print (dirshire_person )[ : ',dirshire_person )- :]list of class attributes shire_person ('sam 'create an instance shire_person ('frodo 'create another instance print ( __dict__ list of instance attributes race 'hobbit age print ( __dict__ add another attribute to instance change instance attribute print getattr ( ,'address ')content of ' class attribute [__delattr__ ''__dict__ ''__dir__ ''__doc__ '[__weakref__ ''address '{'name ''sam ''age ' {'name ''frodo ''age ' 'race ''hobbit 'the shire it is good practice to create all the attributes of the class object in the __init__ methodbutas seen in the example aboveattributes can be created and assigned everywhereeven outside the class definition more generallyattributes can be added to any object that has __dict__ an "emptyclass can be created via class pass inheritance python classes can be derived from parent class by inheritancevia the following syntax class ()