Skip to content

Instantly share code, notes, and snippets.

@Robofied
Created February 3, 2019 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Robofied/f271bbd5715b4a3fcce3fed1bb527c5f to your computer and use it in GitHub Desktop.
Save Robofied/f271bbd5715b4a3fcce3fed1bb527c5f to your computer and use it in GitHub Desktop.
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