Explain the difference between local and global namespaces?



Explain the difference between local and global namespaces?..

Answer / Pragati Singh

"Local namespace refers to variables defined within a function or block of code. These variables are only accessible within that function or block, and any variable with the same name in a different function will be treated as a separate entity.nGlobal namespace, on the other hand, contains all the variables that are not defined within any function. Global variables can be accessed from anywhere within the script."

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Python Interview Questions

What is class used for in python?

1 Answers  


Explain me what is flask-wtf and what are their features?

1 Answers  


Is there a tool to help find bugs or perform static analysis?

1 Answers  


What does the enum function in python do?

1 Answers  


What is the other way of checking truthiness?

1 Answers  


What is the output for the following code?

1 Answers  


What should I learn in python?

1 Answers  


Explain about dir() and help() function will do in python?

1 Answers  


How we can copy an object in python?

1 Answers  


What are closures in python?

1 Answers  


Does python have polymorphism?

1 Answers  


Describe how to send mail from a Python script.

1 Answers  


Categories