Created
September 11, 2019 22:29
-
-
Save jackpordi/adb4c47352a67d864fc5b2ad5fd5d6e2 to your computer and use it in GitHub Desktop.
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
current_count = 0 | |
def add_counter(x): | |
global current_count | |
current_count = current_count + 1 | |
return x + current_count | |
print(add_counter(5)) # Prints 6 | |
print(add_counter(5)) # Prints 7 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment