Last active
October 22, 2017 11:44
-
-
Save pykong/a7ab8ff38b1a64edae8b1451868f3830 to your computer and use it in GitHub Desktop.
Can be used to implement memoization as well.
This file contains hidden or 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
def mt(a, memo=[]): | |
a += 1 | |
print(a) | |
memo.append(a) | |
print(memo) | |
mt(1) | |
mt(2) | |
mt(3) |
This file contains hidden or 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
[2] | |
3 | |
[2, 3] | |
4 | |
[2, 3, 4] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment