Lots of Errors - Careful, Will Robinson!


#1



https://www.codecademy.com/en/courses/python-beginner-en-4XuFm/1/2?curriculum_id=4f89dab3d788890003000096#

Gives this error message if I didn't enter the correct coordinates.

Traceback (most recent call last):
File "python", line 34, in
File "python", line 10, in print_board
TypeError: sequence item 1: expected string, list found


It shouldn't give any errors at all.


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)


#2

Never mind, I got it figured out.


#3

So, what was the problem? I'm also struggling at the same place.


#4

You shouldn't have the square brackets around the "X".


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.