Created
February 3, 2019 14:32
-
-
Save Robofied/f271bbd5715b4a3fcce3fed1bb527c5f to your computer and use it in GitHub Desktop.
This file contains 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
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