Instance attributes are those attributes that are not shared by objects. Every object has its own copy of the instance attribute i.e. for every object, instance attribute is different.
There are two ways to access the instance variable of class:
Example 1: Using Self and object reference
hello my name is: HARRY my roll number is: 1001 HARRY
Example 2: Using getattr()
Harsh True 152
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.