Search the courses, subjects, tracks, games and features, or jump straight to a page.
4 cards from this section. Quick, good the night before a test.
What does the LEGB rule stand for?
Recall the order of variable resolution in Python.
Define a local variable.
Think about where you can use this variable.
What is the first step in the LEGB resolution process?
Remember the order of scope.
True or False: Global variables can be accessed from within functions without needing a keyword.
Check if you can access a globally defined variable from inside a function.
Create a Python script that demonstrates both local and global variable scopes along with the use of the global keyword.
Check how the global variable changes after calling the function.
Explain the difference between global and nonlocal keywords by providing a code example for each.
Differentiate their scopes when you use them in nested functions.
6 more questions in this section. Enroll free to practise them all.
Enroll free