0

The last line makes all values in y+i[1] column in Array (List of lists) are the same, not only that one with indexes [x+i[0]][y+i[1]], which was my goal, what is the problem?

indeks="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
w, h = [int(i) for i in input().split()]
T=[]
T2=[['-1']*w]*h
queue=[]
ruchy=[[1,0],[-1,0],[0,1],[0,-1]]

def bfs(x,y):
    for i in ruchy:
        if x+i[0]>=0 and x+i[0]<w and y+i[1]>=0 and y+i[1]<h:
            a=T[x+i[0]][y+i[1]]
            b=T2[x+i[0]][y+i[1]]
            if a=='.' and b=='-1':
                queue.append([x+i[0],y+i[1]])
                liczba=T2[x][y]
                ind=indeks.index(liczba)+1
                var=indeks[ind]
                T2[x+i[0]][y+i[1]]=var
Kat
  • 29
  • 5

0 Answers0