Here’s the problem I’m working on:
Assume that the developers of Myro are developing a new black box
function called traveler(String str ) that moves a robot in a specific
direction (i.e., North, South, East, or West) for a specific number of
feet (e.g., 1 = one foot, 2 = two feet, etc.) The parameter of the
traveler( ) function is a String variable that expresses both the
direction and the distance. For example, traveler(E2) would move the
robot East for two feet while traveler(N6) would move the robot North
for six feet.Write a short segment of code that uses the black box traveler( )
function to move the robot from Point A to Point B in the grid shown
below.
- Assign the parameters (e.g. N2, etc.) to a data structure.
- Traverse the data structure with a loop that supplies the parameters to the traveler( ) function.

The traveler(String str) function does not really exist. Treat it as
if it did and simply write a short segment of code to accomplish the
task of moving the robot along the pattern given above.
Here’s what I have:
def main():
go = [N2, W1, N3, E4, S1, W1, S1, E2]
for g go:
traveler(g)
main()
My question is how would finish this up?
traversing lists in python is generally done by using a
forloopExample from python documentation:
In the above example
lenis a built in function. They are passingwto thelenfunction. This is very simliar to what you need to do with thetravelerfunction.Loop through every item in
golist. Pass that item totraveler