1. Home
  2. Data Science
  3. Python
  4. What does LEGB stand for in Python scope resolution?

Added 25 Nov 2026

What does LEGB stand for in Python scope resolution?

  1. Local, External, Global, Base
  2. List, Extend, Get, Break
  3. Loop, Else, Goto, Begin
  4. Local, Enclosing, Global, Built-in Correct answer

Correct answer

D. Local, Enclosing, Global, Built-in

8 views

MCQSEXAM

Explanation

Python looks up names in Local, Enclosing, Global and Built-in scopes in that order.

Reference

Asked in: Python Interview Functions

https://docs.python.org/3/tutorial/controlflow.html#defining-functions

Preparing for an exam?

Doubts & discussion

Not sure why the answer is D? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Python MCQs

Practise all Python MCQs

Similar MCQs