2-dimensional list


#1

Hi guys, could you explain me how do 2-dimensional list work and at which point have I made one ? :confused:

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

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

random_row(board)
random_col(board)


#2

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