I have the following example in my book, which is supposed to be a program whch calculates the new balance after interest is added on multiple accounts:
def addInterest(balances, rate):
    for i in range (len(balances)):
    balances[i] = balances[i] * (1 + rate)
def test():
    amounts = [1000, 2200, 800, 360]
    rate = 0.05
    addInterest(amounts, rate)
    print(amounts)
test()
The output is [1050.0, 2310.0, 840.0, 378.0]
There is no return call at the end of addInterest, so why doesn't print(amounts) just print amounts which was defined intially, namely [1000, 2200, 800, 360]?
 
     
     
     
     
    