functions that modify parameters return values are the main way to send information from function back to the part of the program that called the function in some casesfunctions can also communicate back to the calling program by making changes to the function parameters understanding when and how this is possible requires the mastery of some subtle details about how assignment works in python and the effect this has on the relationship between the actual and formal parameters used in function call let' start with simple example suppose you are writing program that manages bank accounts or investments one of the common tasks that must be performed is to accumulate interest on an account (as we did in the future value programwe might consider writing function that automatically adds the interest to the account balance here is first attempt at such functionaddinterest py def addinterest(balancerate)newbalance balance ( +ratebalance newbalance the intent of this function is to set the balance of the account to value that has been updated by the amount of interest let' try out our function by writing very small test program def test()amount rate addinterest(amountrateprint(amountwhat to you think this program will printour intent is that should be added to amountgiving result of here' what actually happensaddinterest test( as you can seeamount is unchangedwhat has gone wrongactuallynothing has gone wrong if you consider carefully what we have discussed so far regarding functions and parametersyou will see that this is exactly the result that we should expect let' trace the execution of this example to see what happens the first two lines of the test function create two local variables called amount and rate which are given the initial values of and respectively nextcontrol transfers to the addinterest function the formal parameters balance and rate are assigned the values from the actual parameters amount and rate remembereven though the name rate appears in both functionsthese are two separate variables the situation as addinterest begins to execute is shown in figure notice that the assignment of parameters causes the variables balance and rate in addinterest to refer to the values of the actual parameters