Hide... doesnt seems to be recognising my functions


#1



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)

def random_row(board):
-for row in board:
--return radint(0, len(board) - 1)

def random_col(board):
-for col in board:
--return radint(0, len(board) - 1)

https://www.codecademy.com/courses/python-beginner-en-4XuFm/0/7?curriculum_id=4f89dab3d788890003000096#


I tried refreshing the page just in case it was a connectivity issue, still no luck:/
Oops, try again. Did you create a function called random_row?


Replace this line with your code.


#2

It would be much easier both for you and myself if you would post your preformatted, indented code,

You can learn how to do that here,


#3

board = []

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

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

def random_row(board):
    for row in board:
        return radint(0, len(board) - 1)
    
def random_col(board):
    for col in board:
        return radint(0, len(board) - 1)

#4

Found it, i was using radint where i needed randint.


#5

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