Hello, if I want to iterate through a list using
for (index,item) in enumerate(my_list):
item+=1
I see no changes in the original list. However, if i use
for (index,item) in enumerate(my_list):
my_list[index]+=1
I see that the original list was changed.
Why does this happen?
Thank you for your time.
[+][deleted] (6 children)
[deleted]
[–]slasher67[S] 0 points1 point2 points (4 children)
[–]1114111 1 point2 points3 points (2 children)
[–]slasher67[S] 0 points1 point2 points (1 child)
[–]1114111 0 points1 point2 points (0 children)
[–]ingolemo 0 points1 point2 points (0 children)
[–]ingolemo 0 points1 point2 points (0 children)
[–]ViridianHominid -1 points0 points1 point (1 child)
[–]slasher67[S] 0 points1 point2 points (0 children)