Title: Scope
A scope (visibility of name) refers to a region of a program where a namespace can be directly accessed. Scopes are defined statically, but they are used dynamically.
e.g
var1 = 5 # global scope
def some_func(): # global scope
var2 = 6 # local scope
Python scope concept follows a rule known as the LEGB (Local, Enclosing, Global, and Built-in scopes).
When we call a name, Python starts searching it from local scopes and ends in built-is scopes. If it cannot find, you get a NameError.
Post #100
442