How Do I Replace A Specific String In A 2d Array?
I'm making a program that Identifies if a blank tile exists or not. I already have a code in my 2d array which is  arr2 = [['0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0'
Solution 1:
You have to enumerate your array to change the value at a specific index.
for i, row in enumerate(arr2):
    for j, cell in enumerate(row):
        ifcell== '#':
            arr2[i][j] = 'A'Solution 2:
You are replacing the contents of the variable i, not the element of the array from which it came.
Post a Comment for "How Do I Replace A Specific String In A 2d Array?"