Question -
Answer -
The globals( ) and locals( ) functions can be used to return-the names in the global and local namespaces depending on the location from where they are called.
If locals() is called from within a function, it will return all the names that can be accessed locally from that function.
If globals() is called from within a function, it will return all the names that can be accessed globally from that function .The return type of both these functions is dictionary. Therefore, names can be extracted using the keys() function