From a033a625321f73a02f9d4d44aa81464320be7993 Mon Sep 17 00:00:00 2001 From: marcv Date: Thu, 1 Oct 2026 10:35:23 +0200 Subject: [PATCH] add file change_global_var_from_within_function.py --- change_global_var_from_within_function.py | 8 ++++++++ test.py | 0 2 files changed, 8 insertions(+) create mode 100644 change_global_var_from_within_function.py create mode 100644 test.py diff --git a/change_global_var_from_within_function.py b/change_global_var_from_within_function.py new file mode 100644 index 0000000..f23fee1 --- /dev/null +++ b/change_global_var_from_within_function.py @@ -0,0 +1,8 @@ +global_var = "var1" + +def change_global_var(): + global global_var + global_var = 'var2' + +change_global_var() +print(global_var) \ No newline at end of file diff --git a/test.py b/test.py new file mode 100644 index 0000000..e69de29