Battleship!- 7.Hide


I am stuck on the topic Hide...
Not sure whats wrong with the code but the error message keeps showing "Oops, try again. Did you create a function called random_row?"

would be great if anyone can help me

Thanks in advance!

from random import randint 

board = []

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

def print_board(board):
    for row in board:
        print " ".join(row)

# Add your code below!

def random_row(board): 
    return randit(0, len(board) -1)
def random_col(board): 
    return randit(0, len(board) -1)

print board


you misspelled randint (randint is short for random integer, if that makes it easier to remember)


Was so focus on the error message to "def random_row(board):" and didnt check the rest...

got it thanks!


Those error messages are not perfect, never rely on them for 100%. While doing this course, also teach yourself to debug.


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