What is scope of variables ?explain.
Ans.-
The scope of variables depend upon the location where the variable is
being declared.
The variable
declared in one part of the program may not be accessible to the other part.
In python,
the variable is defined with the two types of scopes.
1.)
Global
scope
2.)
Local
scope
The variable
defined outside any function is known to have a global scope whereas the
variable defined inside a function to have a local scope.