Question: Python Suppose you want to start from your home and drive around your neighborhood and get back to exactly where you started (your home) and

 Python Suppose you want to start from your home and drive

Python

Suppose you want to start from your home and drive around your neighborhood and get back to exactly where you started (your home) and you want this ride to exactly take 10 minutes. Assume that all roads are laid out in a perfect grid. Suppose there is an app that gives users random paths to drive throughout the city. Every time you press the button, it gives you a random set of one-letter strings representing the directions to take. For example, [N, W, W, S', E'] means that go one block to north, two blocks to west, one block to south and one block to east. Knowing that it takes you one minute to traverse one city block, create a function that given a path from the app, will return true if the path will take you exactly ten minutes to drive and will return you where you started from (home). Return false otherwise Note: you will always receive a valid array containing a random assortment of direction letters ('N, 'S', 'E', or 'W" only). It will never give you an empty array

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!