OnlinePython

Object Methods Exercise

Question 1 of 5

What will be the output of this code?

class Counter:
    def __init__(self):
        self.value = 0
    
    def increment(self):
        self.value += 1
        return self.value
    
    def reset(self):
        self.value = 0
        return 'Reset'

c = Counter()
print(c.increment())
print(c.increment())
print(c.reset())