3. Local and Global VariablesΒΆ
Note: The scope of
a
in the example below is different in the two cases. In other words, the two variablesa
are different.
In this case, we use the keyword global. So, the variable
a
inside the function is the same as the variable defined earlier, that is, it is the global variable.
Observe the difference in the outputs in examples 9 and 10.
You have attempted of activities on this page