# Modify list # Return copy of reference back to caller def fun1(aListCopy): aListCopy[1] = aListCopy[1] * 2 aListCopy[3] = aListCopy[3] * 2 return aListCopy # Modify list # Because aList copy refers to the list in 'start()' the return # isn't needed def fun2(aListCopy): aListCopy[1] = aListCopy[1] * 2 aListCopy[3] = aListCopy[3] * 2 # Make a new list that's local to 'fun3()' # This time only the local list (fun3) changed # The list in start is unchanged def fun3(aListCopy): # aListCopy now refers to local list seperate from one in start() # Changes made only to local copy and not to the one in start() aListCopy = [1,2,3,4] aListCopy[1] = aListCopy[1] * 2 aListCopy[3] = aListCopy[3] * 2 print("Copy of list local only to fun3():\t", end="") print(aListCopy) def start(): aList = [1,2,3,4] print("Original list in start() before function calls:\t", end="") print(aList) aList = fun1(aList) print("Original list in start() after calling fun1():\t", end="") print(aList) fun2(aList) print("Original list in start() after calling fun2():\t", end="") print(aList) fun3(aList) print("Original list in start() after calling fun3:\t", end="") print(aList) start()