The LEGB Rule & Understanding Python Scope Quiz
Interactive Quiz ⋅ 8 Questions
By Joseph Peart
In this quiz, you’ll test your understanding of The LEGB Rule & Understanding Python Scope.
By working through this quiz, you’ll revisit how Python resolves names using the LEGB rule, what the local, enclosing, global, and built-in scopes look like in practice, and how the global and nonlocal statements let you reach across scope boundaries.
The quiz contains 8 questions and there is no time limit. You’ll get 1 point for each correct answer. At the end of the quiz, you’ll receive a total score. The maximum score is 100%. Good luck!
Related Resources
Course
The LEGB Rule & Understanding Python Scope
In this step-by-step video course, you'll learn what scopes are, how they work, and how to use them effectively to avoid name collisions in your code.