8... and Seek!


#1



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


I want to know why from exercise 7 to 8 the program changes my code
From:
def random_col(board):
return randint(0, len(board) - 1)

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


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


#2

This lets the columns remain independent of the rows. If the board is not square, then the two lengths will be different. This takes that possibility into account.


#3

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