python local variables

'''Local variables are those that are defined in a block '''
a = 1 #This is NOT a local variable, this is a global variable
def add():
  b = 1 #This IS a local variable
#If we tried to print(b) outside of the add() function, we would get an error

Here is what the above code is Doing:
1. We define a global variable a
2. We define a function add()
3. Inside the add() function, we define a local variable b
4. We print the value of b
5. We call the add() function
6. We try to print the value of b outside of the add() function