I am new at Python and wonder how a function can act on variables and collections. I do not understand why my update_int function cannot update an int whereas update_list can?
def update_int(i):
i = 1
i = 0
update_int(i)
print i
returns 0
def update_list(alist):
alist[0] = 1
i = [0]
update_list(i)
print i
returns [1]