summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislav (Stanley) Modrak <44023416+smith558@users.noreply.github.com>2022-10-26 19:30:44 +0100
committerGitHub <noreply@github.com>2022-10-26 19:30:44 +0100
commit25e194aa0fe8cb82ca8f68c14993d31bf55bf034 (patch)
tree9cafa077126602e698d27bb8d23f0cae4cea2f9a
parent610676c76efa7532975cfcc8dc5b8b69cdce1a84 (diff)
Update python.html.markdown
-rw-r--r--python.html.markdown6
1 files changed, 4 insertions, 2 deletions
diff --git a/python.html.markdown b/python.html.markdown
index 22827963..687529b5 100644
--- a/python.html.markdown
+++ b/python.html.markdown
@@ -613,15 +613,17 @@ y = 2
x, y = swap(x, y) # => x = 2, y = 1
# (x, y) = swap(x,y) # Again parenthesis have been excluded but can be included.
-# Function Scope
+# global scope
x = 5
def set_x(num):
- # Local var x not the same as global variable x
+ # local scope begins here
+ # local var x not the same as global var x
x = num # => 43
print(x) # => 43
def set_global_x(num):
+ # global indicates that particular var lives in the global scope
global x
print(x) # => 5
x = num # global var x is now set to 6