## # scope1.py # # Stephanie Taylor # Sep 25, 2023 # # Demonstrates that Python has file-level scope and function-level scopre # and that within a function, we can only read the file-level scope variable (can't write to it) # and we can't mix file-level and function-level references to variables with the same name in the same function ## file = 0 def change_file(): ''' This function is called change_file, but it won't do so ''' print(file) # Can't have a reference to the file -level var before make a function-level var file = 1 # makes a new function-level var print(file) # but this one works print(file) change_file() print(file)