1
I have the following code:
current = [0, 1]
someList = []
while True:
for n in range(0, 2):
current[n] += 1
print(current) # [1,2] and [2,3]
someList.append(current)
if current == [2, 3]:
break
print(someList) # [[2,3], [2,3]]
At each loop the variable current
receives +1 for each item, when the current
reaches the value [2,3]
the loop stop. The supposed to be the someList
have a value of [[1,2], [2,3]]
but always ends with the ultimate value of current
, that is, ended with [[2,3], [2,3]]
. Why does this happen?