Could anyone, please, explain what exactly happens in the following code to the "element" during iteration?
array = [2,3,4]
for element in array:
element = 3
print(array)
>>>[2, 3, 4]
Output is [2, 3, 4] instead of [3, 3, 3]
Did I understand it correctly that when using "for element in l" syntax, we can only reference but not modify each element of an array of what does happen here?
P.S. I've seen the question named "why shouldn't you iterate like 'for element in array' ", but I couldn't find that one, so I asked it in this way. Seems like I found one of the disadvantages of iterating in this way. Please, redirect me to the mentioned question if possible.