# Program to demonstrate you can't pass changes to parameters # back to the caller through the the argument list # Matt Bishop, Apr. 27, 2009 # for ECS 10 Spring 2009 # this routine tries changes outp # parameters: inp, an integer # outp, an integer def testparam(inp, outp): # announce the values on entry to the function print "test begins: inp =", inp, "and outp =", outp; # change the value of outp outp = inp + 10; # announce the values to see if the change worked print "test ends: inp =", inp, "and outp =", outp; # call a function that changes parameter values # and see if the change is reflected in the caller # calls: testparam def main(): # set the values to be used a = 1; b = 2; # announce the values in the caller, before the call print "program begins: a =", a, "and b =", b; # now make the call testparam(a, b); # announce the values in the caller, after the call print "program ends: a =", a, "and b =", b; main();