Battleship!- 7.Hide


#1



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


#2

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


#3

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

got it thanks!


#4

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


#5

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