A class attribute that counts objects
Predict the outputEasyPython only
class Counter:
count = 0
def __init__(self):
Counter.count += 1
self.id = Counter.count
a = Counter()
b = Counter()
c = Counter()
print(a.id, b.id, c.id)
print(Counter.count, a.count)
Graded by exact match. Spaces at the ends of lines and blank lines at the end do not count.
to answer and keep your progress. Reading is free for everyone.