
"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!"
The quiz focuses on how Python resolves names using the LEGB rule. Name lookup proceeds through local scope, then enclosing scope, then global scope, and finally built-in scope. It examines what each scope contains and how variables behave when defined in different places. It also covers how the global statement allows assignments to affect the global scope from within a nested scope. It covers how the nonlocal statement allows assignments to affect the nearest enclosing scope rather than creating a new local variable. The quiz uses eight questions to test understanding and provides a score at the end.
Read at Realpython
Unable to calculate read time
Collection
[
|
...
]