Quiz · Classes · lesson 2 of 11
Quiz — two instances
What does the program print?
class Counter:
def __init__(self):
self.value = 0
def add(self, n):
self.value += n
a = Counter()
b = Counter()
a.add(5)
print(a.value, b.value)Subscribe to take the course
The course is free. Sign in with Telegram and subscribe to the channel to open every lesson.