# Program to demonstrate you can't pass changes to parameters # back to the caller through the the argument list # # Matt Bishop, MHI 289I, Winter 2018 # 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 # # 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