11. Danger, Will Robinson! - traceback error


#1



Hi guys, got this error
Traceback (most recent call last):
File "python", line 33, in
TypeError: list indices must be integers, not tuple


Write your code below!

if guess_row==ship_row and guess_col==ship_col:
print "Congratulations! You sank my battleship!"
else :
print "You missed my battleship!"
board[guess_row,guess_col]=="X"

print_board(board)


Replace this line with your code.


#2

to access a multi-dimensional list you need to use square brackets twice:

board[coordinate1][coordinate2]

what you did create a tulpe


#3

for board[guess_row][guess_col]=="X"

i got the same error:(


#4

You need to set this coordinate to X, not compare it with X. I helped you with the error which occurred, which means you can move forward a bit, and then you should take a moment to see if you can find what is causing the new error message


#5

it should be just board[guess_row][guess_col] = "X"
not ==


#6

my answer was already marked as solved and said the same thing? Not sure what the value of your answer is


#7