Custom Print 5/19 Battleships!


#1

Task: Custom Print
Code: board = []

for _ in range(0, 5):
board.append(['O'] * 5
def print_board(board):
for row in board:
print row

print_board(board)

Problem:File "python", line 5
def print_board(board):
^
SyntaxError: invalid syntax


#2

Apart from the obvious indentations what is the problem here? can someone help please?


#3

look at the line above where you get the error message, especially pay attention to the parentheses.


#4

thanks u legend that completely went over my head


#5

you're welcome, also, if you want indent to show on the forum you need to use markup, there is a topic which explains this nicely:


#6

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