new local scope is created whenever function is calledincluding when function is called from another function consider this programdef spam()eggs bacon(print(eggsdef bacon()ham eggs spam(you can view the execution of this program at /otherlocalscopeswhen the program startsthe spam(function is called and local scope is created the local variable eggs is set to then the bacon(function is called and second local scope is created multiple local scopes can exist at the same time in this new local scopethe local variable ham is set to and local variable eggs--which is different from the one in spam()' local scope--is also created and set to when bacon(returnsthe local scope for that call is destroyedincluding its eggs variable the program execution continues in the spam(function to print the value of eggs since the local scope for the call to spam(still existsthe only eggs variable is the spam(function' eggs variablewhich was set to this is what the program prints the upshot is that local variables in one function are completely separate from the local variables in another function global variables can be read from local scope consider the following programdef spam()print(eggseggs spam(print(eggsyou can view the execution of this program at /readglobalsince there is no parameter named eggs or any code that assigns eggs value in the spam(functionwhen eggs is used in spam()python considers it reference to the global variable eggs this is why is printed when the previous program is run functions