Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
a = "Hello! Welcome to python tutorials."
def func():
## Now by using "global" keyword we are actually modifying the global variable a instead of creating a new local variable.
global a
## assigning a new value
a = "Hello!"
print(a)
func()
## Here it will print the global variable a's value but with modified one.
print(a)
#[Output]:
Hello!
'Hello!'
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.