spam(print(eggswhen you run this programthe final print(call will output thisspam you can view the execution of this program at /globalstatementbecause eggs is declared global at the top of spam(when eggs is set to 'spamthis assignment is done to the globally scoped eggs no local eggs variable is created there are four rules to tell whether variable is in local scope or global scopeif variable is being used in the global scope (that isoutside of all functions)then it is always global variable if there is global statement for that variable in functionit is global variable otherwiseif the variable is used in an assignment statement in the functionit is local variable but if the variable is not used in an assignment statementit is global variable to get better feel for these ruleshere' an example program enter the following code into the file editor and save it as samenamelocalglobal pydef spam()global eggs eggs 'spamthis is the global def bacon()eggs 'baconthis is local def ham()print(eggsthis is the global eggs this is the global spam(print(eggsin the spam(functioneggs is the global eggs variable because there' global statement for eggs at the beginning of the function in bacon()eggs is local variable because there' an assignment statement for it in that function in ham(eggs is the global variable because there is no assignment statement or global statement for it in that function if you run samenamelocalglobal pythe output will look like thisspam functions