Created
November 17, 2017 19:15
-
-
Save topher200/f8fb9be2f8f61325290858c2197a54a0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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