7. Help


I've seen this shared in a thread below as a correct, working code, which I looked up after giving the exercise an honest try. Yet, it keeps asking me if I created a function called "random_row," which I believe I clearly did. Please advise?

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 randint(0, len(board) -1)

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


Hi @vtexposfan ,

Refresh the page, and submit it again.

It would be best to print the results of calling each of the functions. For example, you have ...


You called the function, but will not see any result displayed.

Try this instead ...

print random_row(board)

Do the same for random_col. You can remove those print statements later.


Worked like a charm. Thank you! This site is great...learning something I should have learned 2 1/2 years ago when I knew that my old job was circling the drain.