Computer Science
What is scope ? What is the scope resolving rule of Python ?
Python Functions
3 Likes
Answer
Scope refers to part(s) of program within which a name is legal and accessible. When we access a variable from within a program or function, Python follows name resolution rule, also known as LEGB rule. When Python encounters a name (variable or function), it first searches the local scope (L), then the enclosing scope (E), then the global scope (G), and finally the built-in scope (B).
Answered By
1 Like