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 each letter in LEGB stand for?
You can think of the order Python uses to check variable names.
Provide an example of a Local variable.
Remember, it's defined within a function.
What does 'G' stand for in LEGB?
Think of where the variable is accessible.
True or False: The local variables are accessible from outside the function.
Consider the scope of variables.
Create a function that defines a local variable and attempts to print it from outside the function.
Consider where you are trying to access the variable.
Write a code segment that uses the 'nonlocal' keyword to modify a variable in an enclosing scope.
Think about how nested functions interact with variable scope.
6 more questions in this section. Enroll free to practise them all.
Enroll free