filmov
tv
Python Scope Local & Global

Показать описание
A variable is only available from inside the region it is created. This is called scope
Local Scope
A variable created inside a function belongs to the local scope of that function, and can only be used inside that function.
Global Scope
A variable created in the main body of the Python code is a global variable and belongs to the global scope.
Global variables are available from within any scope, global and local.
Local Scope
A variable created inside a function belongs to the local scope of that function, and can only be used inside that function.
Global Scope
A variable created in the main body of the Python code is a global variable and belongs to the global scope.
Global variables are available from within any scope, global and local.