remember where to return if another function call is madepython puts another frame object on the call stack above the other one when function call returnspython removes frame object from the top of the stack and moves the execution to the line number stored in it note that frame objects are always added and removed from the top of the stack and not from any other place figure - illustrates the state of the call stack in abcdcallstack py as each function is called and returns ( ( ( ( ( ( ( ( ( ( ( (figure - the frame objects of the call stack as abcdcallstack py calls and returns from functions the top of the call stack is which function the execution is currently in when the call stack is emptythe execution is on line outside of all functions the call stack is technical detail that you don' strictly need to know about to write programs it' enough to understand that function calls return to the line number they were called from howeverunderstanding call stacks makes it easier to understand local and global scopesdescribed in the next section local and global scope parameters and variables that are assigned in called function are said to exist in that function' local scope variables that are assigned outside all functions are said to exist in the global scope variable that exists in local scope is called local variablewhile variable that exists in the global scope is called global variable variable must be one or the otherit cannot be both local and global think of scope as container for variables when scope is destroyedall the values stored in the scope' variables are forgotten there is only one global scopeand it is created when your program begins when your program terminatesthe global scope is destroyedand all its variables are forgotten otherwisethe next time you ran programthe variables would remember their values from the last time you ran it local scope is created whenever function is called any variables assigned in the function exist within the function' local scope when the function returnsthe local scope is destroyedand these variables are forgotten the next time you call the functionthe local variables will not remember the values stored in them from the last time the function was called local variables are also stored in frame objects on the call stack functions