CSC111 Exercises with Global Variables

From dftwiki3
Revision as of 16:38, 24 April 2014 by Thiebaut (talk | contribs)
Jump to: navigation, search

--D. Thiebaut (talk) 15:57, 24 April 2014 (EDT)



Predict the output of the following programs, of if they crash, indicate why.

Exercise1


A = 3

def f1( x ):
    print( "f1", x, A )

print( "A = ", A )
f1( 30 )


Exercise2


def f1( x ):
    print( "f1", x, A )

f1( 30 )
print( "A = ", A )