A class keeps a count in a class variable. class Counter: count = 0 def __init__(self): self.count += 1 a = Counter() b = Counter() Counter.count = 10 c = Counter() print(a.count, b.count, c.count, Counter.count) What does the program print?
Log in to join the discussion.
Loading…