Created
October 5, 2015 13:34
-
-
Save feliperuhland/a4aa3ef56c248a1007e3 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
Python 2.7.10 (default, Sep 7 2015, 13:51:49) | |
[GCC 5.2.0] on linux2 | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> a = 1 | |
>>> def aa(): | |
... print(a) | |
... | |
>>> aa() | |
1 | |
>>> def aa(): | |
... print(a) | |
... a = a + 1 | |
... | |
>>> aa() | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
File "<stdin>", line 2, in aa | |
UnboundLocalError: local variable 'a' referenced before assignment |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment