Recent Tweets @versorge
To set the global variable inside a function, I need to use the global statement. This declares the inner variable to have module scope. Now var remains ‘bar’ after the function is called.
var = 'foo'
def ex3():
    global var
    var = 'bar'
    print 'inside the function var is ', var
ex3()
print 'outside the function var is ', var
inside the function var is  bar
outside the function var is  bar

I feel like such a goon for forgetting this but I do wear many hats…

Thank you SaltyCrane!