Skip to content

Instantly share code, notes, and snippets.

@topher200
Created November 17, 2017 19:15
Show Gist options
  • Save topher200/f8fb9be2f8f61325290858c2197a54a0 to your computer and use it in GitHub Desktop.
Save topher200/f8fb9be2f8f61325290858c2197a54a0 to your computer and use it in GitHub Desktop.
In [11]: class Counter():
...: def __init__(self):
...: self.__counter = 0
...:
...: def count(self, increment):
...: self.__counter += increment
...: return self.__counter
...:
...:
In [12]: c = Counter()
In [13]: c.count(1)
Out[13]: 1
In [14]: c.count(1)
Out[14]: 2
In [15]: c.count(1)
Out[15]: 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment