We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add section with the following (see lecture slides):
Local example:
def print_scope(): s = "I am local" print(s)
print_scope() print(s)
Global example 1: s = "I am global"
def print_scope(): print(s)
Global example 2: s = "I am global"
Global example 3: def set_scope(): global s s = "I am global"
set_scope() print(s) # this will print I am global
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Add section with the following (see lecture slides):
Local example:
def print_scope():
s = "I am local"
print(s)
print_scope()
print(s)
Global example 1:
s = "I am global"
def print_scope():
print(s)
print_scope()
print(s)
Global example 2:
s = "I am global"
def print_scope():
s = "I am local"
print(s)
print_scope()
print(s)
Global example 3:
def set_scope():
global s
s = "I am global"
set_scope()
print(s) # this will print I am global
The text was updated successfully, but these errors were encountered: