1 class A: 2 "A class with attribute and method." 3 x = 123 4 def m(self, x): 5 self.x = x 6 a1 = A() 7 a2 = A() 8 y = A.x 9 a1.m(321) 10 a2.m("321") 11 z1 = a1.x 12 z2 = a2.x