ā back to unit
Medium
# breaking it down medium
Turtle in the Garden
The garden turtle wanders the grid: N, S, E, W, one square at a time, starting at (0, 0). š¢
You get the moves. Print x <final x> y <final y> on line one (E adds to x, N adds to y). On line two print came home yes if it ever RETURNED to (0,0) after leaving, else came home no.
Example:
Input: moves = "NESW"
Output:
x 0 y 0
came home yes
N, E, S, W trace out a full square back to (0, 0). Since it returns after leaving, it counts as came home yes.
š” need a hint?
brk-turtle-garden.pyš given lines are locked ā write your code in between
loading...