Created
November 21, 2018 05:35
-
-
Save JackInTaiwan/02f94193fe615a8bd099440e3bcfb591 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
global x | |
x = 10 | |
def add_x(): | |
x = x + 1 | |
if __name__ == "__main__": | |
add_x() | |
# > UnboundLocalError: local variable 'x' referenced before assignment |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment