Skip to content

Instantly share code, notes, and snippets.

@erikaris
Last active December 1, 2017 12:51
Show Gist options
  • Save erikaris/c9dba6e2fd0bee3dd28b6c6e244afef1 to your computer and use it in GitHub Desktop.
Save erikaris/c9dba6e2fd0bee3dd28b6c6e244afef1 to your computer and use it in GitHub Desktop.
# since there is a variable assignment inside function f,
# f will only care about the local variable 's'
# and will not think about the global variable 's'
def f():
print(s)
s = "Mukhlisina"
print(s)
s = "Erika Siregar"
f()
print(s) # s here is the global s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment