CJCoding With Joseph
15free / daySign inCreate account
← Back to Question List
Python Code Walkthrough #41

Two Bumps Of A Counter

easyClasses

📄 Code

Read carefully — what does this print?
1class Counter:
2 def __init__(self, start: int) -> None:
3 self.value: int = start
4 
5 def bump(self) -> None:
6 self.value = self.value + 1
7 
8c: Counter = Counter(5)
9c.bump()
10c.bump()
11print(c.value)
12print(Counter(0).value)

🎯 Your Answer