CBSE Class 12 Computer Science Question 63 of 103

Working with Functions — Question 10

Back to all questions
10
Question

Question 10

What is scope ? What is the scope resolving rule of Python ?

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).