Step 1: Define variable scope.
The scope of a variable refers to the region of a program where the variable can be accessed or used.
Scope determines the visibility and lifetime of variables in a program.
Step 2: Explain Local scope.
A local variable is declared inside a function and can be accessed only within that function.
Once the function finishes execution, the local variable is destroyed.
Example:
\[
\texttt{def show():}
\]
\[
\texttt{\ \ x = 5}
\]
\[
\texttt{\ \ print(x)}
\]
Here \(x\) is a local variable.
Step 3: Explain Global scope.
A global variable is declared outside all functions and can be accessed throughout the program.
Example:
\[
\texttt{x = 10}
\]
\[
\texttt{def show():}
\]
\[
\texttt{\ \ print(x)}
\]
Here \(x\) is a global variable.
Step 4: Conclusion.
Thus the scope of a variable determines where it can be used, and variables may have local or global scope.