For the code:
==============================
a = [1,2,3]
for i in a:
a = [4,5,6]
print(i)
print(a)
==============================
The output I got is
=====================
1
2
3
[4, 5, 6]
=====================
but inside the loop, I changed the list a to [4,5,6]. I think theelement i should change too because i is the element in the list a.But the integer “i” did not change, even if the list change.
Expert Answer
An answer will be send to you shortly. . . . .