Hide... (help to understand something)



the code is working, but i dont really understand why in "row" i need to start from 0 and why in "col" need to start from 1? why not both should start from 0?

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


you are right :slight_smile:

For random_col you have to start from 0 not 1 .


i did at first. but it showed an error...


what was the error message?Did you try after refreshing your page?
now is it fine?

and you have to call the both function at the end.


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