Scopes & Global Variables in Python – Explained
This article will explain and demonstrate scopes in Python – including the global scope and how to declare global variables. What is a Scope? As you move towards building more complex Python applications, you’ll be using functions, loops, try/except statements for error handling, and other more advanced constructs. Which variables are available within each of these constructs is defined by the variable’s scope. The scope is where the variable is available within your program. Different variables have different scopes, and totally distinct/separate variables in different scopes can share … Read more