title: Python class inheritance: how is this output produced?
body: <p>When I run this code it is giving output as 10 10 10 12 24 10. Can anyone please help me in understanding the output? I am new to python programming</p>
  
  <pre><code>class A:
      x = 10
  
  class B(A):
      pass
  
  class C(A):
      pass
  
  print (A.x)
  
  print (B.x)
  
  print (C.x)
  
  A.x += 2
  
  B.x *= 2
  
  C.x -= 2
  
  print (A.x)
  
  print (B.x)
  
  print (C.x)
  </code></pre>