Question: The code box below defines a variable path as a list of directions to navigate a maze. Each instruction is one of the following four
The code box below defines a variable path as a list of directions to navigate a maze. Each instruction is one of the following four basic commands:
north. move one step in the positive y direction
Time left ::
south move one step in the negative y direction
west: move one step in the negative direction
east move one step in the positive direction
Define a function move that takes two arguments, a location as a tuple of and coordinates and an instruction north south, west, east as a string, Given the provided location, it should return the new location as a tuple of and coordinates when following the specified instruction. If the instruction is invalid, the old location should be returned.
Use the function move to determine the final position when starting from the point and following all instructions in the list path. Assign this final position to the variable finallocation.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
