                                                                     
                                                                     
                                                                     
                                             
# simple program from class 11/5/2007
# ... to experiment with local vs global variables
def f(x):
    y = x * x
    x = 0           # can this be seen outside?
    gv = -5         # what happens if you remove this?
    print "x = ", x
    print "gv = ", gv # ... or move AFTER this line?
    return y

def g(x):
    print "gv in g is", gv   # can see the global var
    return x

# main

gv = 10.2

print "before calling f"

z = f(gv)

print "gv is", gv, "and squared it is", z

u = g(gv)

print "now gv is", gv
