Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
## Creating a global variable
a = "Hello! Welcome to python tutorials."
def func():
## It is another local variable of function func()
a = "Hello! Everyone"
## Here it will print the value of global variable "a" which is not changed even if the a's value
## in function func() is changed because func() is not accessing the global variable and then chnaging it.
## It is actually creating another local variable.
## It will print global variable value.
"Hello! Everyone"
"Hello! Welcome to python tutorials."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.