class C:
counter = 0
def __init__(self):
type(self).counter += 1
x=C()
print(x.counter)
print(C.counter)
both the above print statement gives output 1 while if i use self.counter+=1 then the first print gives output 0 and second print gives 1, can anyone explain?