What is global scope?
What is global scope?
a. Global scope only appears when you nest functions within other functions.
b. From the moment we start the program in Python, we are in the global scope. Python turns the main script into a module called __main__
that stores the execution of the main program. The namespace of this module is the global scope of the program.
c. Global scope is created when the function is called. Each time we call the function we create a new global scope. By default, names we assign inside functions only exist in the global scope associated with the function call. When the function exits, the global scope is destroyed.