1.

What is the order of namespaces in which Python looks for an identifier?(a) Python first searches the global namespace, then the local namespace and finally the built-in namespace(b) Python first searches the local namespace, then the global namespace and finally the built-in namespace(c) Python first searches the built-in namespace, then the global namespace and finally the local namespace(d) Python first searches the built-in namespace, then the local namespace and finally the global namespaceI had been asked this question during a job interview.This interesting question is from Python Modules topic in division Mapping Functions and Modules of Python

Answer» RIGHT option is (b) PYTHON first SEARCHES the local NAMESPACE, then the GLOBAL namespace and finally the built-in namespace

Easiest explanation - Python first searches for the local, then the global and finally the built-in namespace.


Discussion

No Comment Found

Related InterviewSolutions