Battleship 5. Custom Print: You can;t sink a battleship without an ocean


I have looked on this forum and everything looks like what I have (I think). I have tried deleting and retyping the trouble line. I get these error messages: File "python", line 5
def print_board(board):
SyntaxError: invalid syntax
and from codecademy:
Oops, try again. Your code threw the following error: invalid syntax (python, line 5)

I expect to get a tranquil sea of O's.

for i in range(0,5):
    board.append(['O']* 5

def print_board(board):
    for row in board:
        print row
print print_board(board)


The ^ indicates the point where parsing ceased, and means the error is before that point. The previous line is where to find the error. Notice?


Ah yes - I must have deleted it deleting the following line. Thank you so much! I did not know the carot symbol meant that..... lol... I think that that I have been going nuts on several lessons before this for that reason...staring at and retyping the same line twenty I am trying to stick with this. This attention to detail is the problem I had when I took FORTRAN in college..... but I will plug along this time until I get better at it.


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