programming languages – Dynamic Binding and Deep and Shallow binding

Var Out = 0 
def x() :
    Out += 1;
def y(F):
    var Out = 0;
    F():
    print "Hello", Out
def z():
    var Out = 0 
    y(x)
    print "Bye", Out 
z()
print "hi", Out

I’m trying to find what the code would output in each of the bindings, dynamic, shallow, and deep.
Knowing why would also be appreciated.