scope to form complete mental picture of how your programs work we should further explore just how the python interpreter executes python program in the first we explored how references are the things which we name and that references point to objectswhich are unnamed howeverwe sometimes call an object by the name of the reference that is pointing at it for instanceif we writex it means that is reference that points to an object with inside it but sometimes we are careless and just say that equals it is important that you understand that even when we say things like equals what we really mean is that is reference that points to an object that contains you can see why we are careless sometimes it takes too many words to say what we really mean and as long as everyone understands that references have names and objects are pointed to by referencesthen we can save the words the rest of this text will make this assumption at times when it is really importantwe'll make sure we distinguish between references and objects part of our mental picture must include scope in python program scope refers to part of program where collection of identifiers are visible let' look at simple example program local scope consider the code in fig in this program there are several scopes every colored region of the figure delimits one of those scopes while executing line of the program in fig the light green region is called the local scope the local scope is the scope of the function that the computer is currently executing when your program is executing line of codethe scope that surrounds that line of code is called the local scope when you reference an identifier in statement in your programpython first examines the local scope to see if the identifier is defined therewithin the local scope an identifieridis defined under one of three conditions statement like id appears somewhere within the current scope in this case id would be reference to an object in the local scope id appears as parameter name of the function in the current scope in this case id would be reference to an object that was passed to the current function as an argument id appears as name of function or class through the use of function def or class definition within the current scope while python is executing line in fig the reference val is defined within its local scope if python finds id in the local scopeit looks up the corresponding value and retrieves it this is what happens when val is encountered on line the object that is referenced by val is retrieved and returned this copy belongs to 'acha