# File: global10.py # # Another example of a function calling # a function. # # Here x is global in test(), so the value # of x in foo() has no effect on the # execution of test(), b is still undefined. # b = 101 def test() : if x == 11: b = 17 print("b = ", b) return def foo() : b = 202 x = 11 test() return b = 303 x = 33 foo() ''' Output from the program: Traceback (most recent call last): File "global10.py", line 27, in foo() File "global10.py", line 22, in foo test() File "global10.py", line 16, in test print("b = ", b) UnboundLocalError: local variable 'b' referenced before assignment '''