Python classes can be clearly separated into class-level and instance-level attributes:
A class attribute belongs to a class rather than a particular instance. All instances of this class can access it and it is defined outside the constructor function of the class.
An instance attribute, which is defined inside the constructor function, belongs to a particular instance. It’s only accessible in this certain instance rather than the class. If we call an instance attribute by the class, there will be an AttributeError.
The above example shows the different usages of class attributes and instance attributes. Separating these two types of attributes clearly can make your Python code more robust.