I want my code to return a square grid full of "x"'s and a single "I" at location (3,2), as seen bellow:
xxxxx
xxxxx
xxixx
xxxxx
xxxxx
I wrote the code bellow originally
grid_frontend = [["x"] * 5] * 5
for i in range(len(grid_frontend)):
for j in range(len(grid_frontend[i])):
if ((i == 3) and (j == 2)):
grid_frontend[3][2] = 'i'
print(grid_frontend[i][j], end='')
print()
the end result of this was:
xxxxx
xxxxx
xxixx
xxixx
xxixx
I also attempted moving the "grid_frontend[3][2] = 'I'" outside of the for loops with out the if statement, this also returned a wrong grid:
xxixx
xxixx
xxixx
xxixx
xxixx
Im not sure why the grid being returned is always being printed incorrectly, there is no other location where the gird if edited, or the function this code is in is looped over.