Last active
August 29, 2015 14:07
-
-
Save treyhunner/c3ed941ead08da3b7d3d to your computer and use it in GitHub Desktop.
Explanation of how variable names work in Python
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 change_variable(x): | |
| x = 100 | |
| a = 3 | |
| print(a) | |
| change_variable(a) | |
| print(a) | |
| b = [1, 2] | |
| print(b) | |
| change_variable(b) | |
| print(b) | |
| def change_list_item(x): | |
| x.append(100) | |
| c = [1, 2] | |
| print(c) | |
| change_list_item(c) | |
| print(c) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment