Hello folks.
Out of the below two approaches, which do you prefer and why?
Approach 1:
class Maze:
def __init__(self, grid):
# use the parameter
self.grid = grid
# number of rows in grid
self.rows = len(self.grid)
# number of columns in grid
self.cols = len(self.grid[0])
Approach 2:
class Maze:
def __init__(self, grid):
# use the parameter
self.grid = grid
# number of rows in grid
self.rows = len(grid)
# number of columns in grid
self.cols = len(grid[0])