1class MyClass:
2 # Class attributes are defined outside of constructor
3 class_attr = 0
4
5 def __init__(self, inst):
6 # Instance attributes are defined in the constructor
7 self.instance_attr = inst
8
9obj = MyClass(1)
10print(obj.class_attr) # outputs 0
11print(obj.instance_attr) # outputs 1
12print(MyClass.class_attr) # outputs 0
13print(MyClass.instance_attr) # raises AttributeError