So in my free Time I've been trying to make a little Programm, however I've run into a slight problem. I want to change some things in a copied list, but for some reason the changes get caried over to the original/base list.
from random import *
a = [[0,5,9,5,9,4,0,0,5],
[0,0,7,0,0,3,0,0,3],
[0,0,5,0,0,0,7,8,45]]
b = a.copy()
for x in range(len(b)):
for y in range(len(b[1])):
if b[x][y] == 0:
b[x][y] = randint(10, 100000)
if a == b:
print("Not working")
print(b)
print(a)
I have also tried b = list(a)
and with the copy library, but all my changes to b still get carried over to a, resulting in a == b
being true.
Does someone know what the problem is or what I'm doing wrong/misunderstanding? Help would be very appreciated and thanks in advance.