Global Scope
Explore how to use the global statement in Python to declare variables as global within functions. Understand the difference between global and local variables, and learn why modifying global variables inside functions is discouraged to avoid debugging issues.
We'll cover the following...
We'll cover the following...
Python includes the global statement. It is a keyword of Python. The
global statement declares a variable as being available for the code
block following the statement. While we can create a name before we declare it global, this is strongly discouraged.