a = []
b = [1,2,3]
from random import randrange
for i in range(100):
if b not in a:
a.append(b)
b[randrange(0, 3)] += 1
My goal with this code is to set it so that every iteration of b
is put into a
. But this is not working, can anyone shed some light?
I thought that it would put every iteration into a
. I thought that as b
changed, the if loop would work as b
was different and so therefore no longer what is in a
.