scopes and namespaces when computing sum with the syntax in pythonthe names and must have been previously associated with objects that serve as valuesa nameerror will be raised if no such definitions are found the process of determining the value associated with an identifier is known as name resolution whenever an identifier is assigned to valuethat definition is made with specific scope top-level assignments are typically made in what is known as global scope assignments made within the body of function typically have scope that is local to that function call thereforean assignmentx within function has no effect on the identifierxin the broader scope each distinct scope in python is represented using an abstraction known as namespace namespace manages all identifiers that are currently defined in given scope figure portrays two namespacesone being that of caller to our count function from section and the other being the local namespace during the execution of that function str float gpa grades str major list target data int item cs str str str abafigure portrayal of the two namespaces associated with user' call count(gradesa )as defined in section the left namespace is the caller' and the right namespace represents the local scope of the function python implements namespace with its own dictionary that maps each identifying string ( to its associated value python provides several ways to examine given namespace the functiondirreports the names of the identifiers in given namespace ( the keys of the dictionary)while the functionvarsreturns the full dictionary by defaultcalls to dirand varsreport on the most locally enclosing namespace in which they are executed