`I'm kind of experienced with Python and I am super confused as to why I am getting an object error even though I am fairly certain that I instantiated the 2D arrays properly. Any insight is greatly appreciated.
I also would like to ask if anyone knows how to replace character specifically within a 2D array with another.
row, col = (10, 10)
playerOneBoard = [[0]*row]*col
playerTwoBoard = [[0]*row]*col
playerOneFound = [["_"]*row]*col
playerTwoFound = [["_"]*row]*col
def placeDestroyer(Player):
if Player == 1:
for a in playerOneBoard:
print(a)
print("\nWhat is the x cooridnate of the destroyer?")
x = int(input(" "))
print("\nWhat is the y coordnate of the destroyer? (Please use integer values)")
y = int(input(" "))
x-= 1
y-= 1
playerOneBoard.insert[x, "D"]
for a in playerOneBoard:
print(a)
The goal for the program was to insert a letter "D" in a specified spot in the 2D array`