Contents

  1. non_function_vars.py

non_function_vars.py

# Using variables that aren't part of any function
# by Sara Sprenkle, 10.16.2007

# create variables that aren't part of any function
non_func = 2
non_func_string = "cat"

def func():
    print "In func: nf =", non_func
    print "In func: nfs =", non_func_string

    # Question: what happens when we try to assign the variables that
    # aren't part of a function a value
    
    # non_func = 6
    # non_func_string = "dog"
   
func()
print non_func
print non_func_string

Generated by GNU enscript 1.6.4.