Battleship 5/19, it doesn't show anything in the console


#1

So, i have this code:

board = [ ]
    for os in range(5):
        board.append(["O"] * 5)

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

print_board

and the exercise says it's ok, but it doesn't show anything in the console even when there's a print in the function, is that normal? is just curiosity though.


#2

Where is your print? In a function
When do functions run? When they are called.
Do you call your function? How does one call a function?


#3

You don't need to indent on line 2
and
print_board change it to print_board(board)
That way it's the function_name(list name as input)


#4

thanks guys, it worked now :smiley:


#5

board = []
for i in range(0, 5):
tiles = ["O"] * 5
board.append(tiles)
print board
def print_board(board):
for row in board:
print row
print_board(board)

This is my code when I run the code it doesnt give any output neither success or error. Could you please let me know the reason why this is happening?