Uploaded by المدمر 4

The Scoping of Variables

advertisement
The Scoping of Variables
The scope of variables in Python for loops is the same as the
enclosing block.
This means that variables defined within a for loop
are accessible outside of the loop after it has completed execution.
In contrast, variables defined within a recursive function are local to
the scope of each recursive call.
This means that variables defined within a recursive function are
only accessible within that specific function call and any nested
function calls.
Download