So I am trying to create a grid that can have it's individual "grid squares" replaced by any given symbol. The grid works fine but it is made of lists within lists.
Here's the code
size = 49
feild = []
for i in range(size):
feild.append([])
for i in range(size):
feild[i].append("#")
feild[4][4] = "@" #This is one of the methods of replacing that I have tried
for i in range(size):
p_feild = str(feild)
p_feild2 = p_feild.replace("[", "")
p_feild3 = p_feild2.replace("]", "")
p_feild4 = p_feild3.replace(",", "")
p_feild5 = p_feild4.replace("'", "")
print(p_feild5)
As you can see that is one way that I have tried to replace the elements, I have also tried:
feild[4[4]] = "@"
and
feild[4] = "@"
The first one replaces all "#" 4 elements in from the left with "@" The second one gives the following error
TypeError: 'int' object is not subscriptable