Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

def can_move_side(grid, positions, go_left): Given a list of positions , determi

ID: 3741368 • Letter: D

Question

def can_move_side(grid, positions, go_left): Given a list of positions , determine if the grid is free if they were shifted left (if go_left is true) or right (otherwise). This should return false if any of the positions , once shifted , is invalid or not open.

? Return value: A boolean indicating if (once shifted) the positions can be used to place something.

? Assumptions: Same as set_positions () for grid and positions .

? Requirement: You must use/call other functions you have written to do this, do not copy that code!   

Explanation / Answer

def can_move_side(grid, positions, go_left): for pos in positions: y, x = pos if go_left: x -= 1 else: x += 1 if 0