list4=[7,8]
def proc3(mylist):
mylist+=[9]
print list4
proc3(list4)
print list4
Why does this code produce the answers [7,8] and [7,8,9]? I expected [7,8] and [7,8]. Doesn't mylist+=[9] concatenate the number 9 and create a new list as a local variable only? Why does the "print list4" after the running proc3(list4), but outside the procedure, not result in the original list? I must be missing something obvious here. Thanks in advance for any help.