LEGB — Variable Scope in Python
Each programming language has its own variable scope. For python, we could simply follow the LEGB rule that includes
Local, Enclose, Global, and Built-in.
In this article, we will use a few examples to understand their feature and how to access objects of different scopes.