Wes House6,944 Points
Why return x,y and not return player?
For the code below, the instructor deletes "return player" and replaces it with "return x,y" and the only explanation as to why is because he wants the values. But why can't it be "return player" since it's already set to x,y? Was that just an arbitrary decision?
def move_player(player, move): x,y = player
if move == "LEFT": x -= 1 if move == "RIGHT": x += 1 if move == "UP": y -= 1 if move == "DOWN": y += 1 return x,y
Steven Parker200,561 Points
The code changes x and y based on the direction of the move. If you were to return "player", you're just giving back the same values you started with. By returning "x, y" you are giving back the new values after the move.