list = [1,2,3] # I want to change it to [2,3,4]
for number in list:
number += 1
print(list) # The result is still [1,2,3]
list = [1,2,3]
i = 1
while i<=len(list):
list[i-1] += 1
i += 1
print(list) # Now the result is [2,3,4]
I want to know the reason why the first for loop won't change the value