I wanted to have a nice set all list elements to a default value
function. The one I came up with doesn't work, but my second solution does. Can anyone tell me why it works one way but not the other?
First solution:
def set_all(the_list,value): #NOT doing anything
for item in the_list:
item = value
Second solution:
def set_all(the_list,value): #working as intended
for i,item in enumerate(the_list):
the_list[i] = value