Question: def is_valid_pos(grid, pos): Given a grid and a position tuple ( pos ), determine if pos is on the grid. ? Return value : A
def is_valid_pos(grid, pos): Given a grid and a position tuple (pos), determine if pos is on the grid".
? Return value : A boolean indicating if the pos is on the grid
? Assumptions:
o grid will be a valid return from the make_grid(()) function
o pos will be a tuple representing an (xx,,yy)) position on the grid
? Hint: Remember that the position (0,1) will be at grid location [1] [0]. If you dont remember why, see Page 2 about how were representing the world.
? Examples: In the following examples, assume g = [[ None, None, None], [None, None, None]]
o is_valid_pos (g, (-1,0)) ? False # ( -1,0) is outside the world
o is_valid_pos (g, (11,2)) ? False # x is valid, but y is not
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
