Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

def find land (map, r, c, dir): Given a map and location, as well as a direction to look (one of [ N ,

image text in transcribed

def find land (map, r, c, dir): Given a map and location, as well as a direction to look (one of [ " N" , " NE " , " E " , " SE " , " S " , "SI " , "W" , " NW" ] )indicate how many spaces we must travel on the map to reach land. If we're on land, the answer is zero. If there's no land in that direction on this map, we return None Assume: map is a map as defined above, r and c are int values, and dir is one of the strings above find_land (map4,2,2,"s") find-land(map4,4,1,"NE") None find_land (map5,7,e,"N")-5 2 map1: [ [e,0,0,0,0], map2 [4,1,e, ,e,0,2], map3 [5,4,5], map4- [5,0,1,e,6], map6 [4,6,7,6,5,4], [e,e,e,9,0], [4,0,e,0,2], e,e,e,e,e], [8,0,3,0,7] ] [6,5,6,5,5,5], [6,5,3,4,5,6], e,e,e,e,e,0], [8,8,8,8,8,6], [8,7,8,9,8,7], [8,8,8,8,8,6] [ , 3, 5,12, 4, 1, , ], map8 [e,e,e,e,e,5,e,e], [e,5,e,e,5,0], e,e,e,e,e,0], [e,5,e,e,5,0], [e,0,7,7,0,0], [e,6,0,0,6,0] e,1,0,e,6,5,e,e], e,1,0,e,e,5,e,e], , 1,2,2,0,5,0,0], [e,e,0,e,4,e,e,e], [e,e,0,e,e,e,8,8], [e,e,e,e,0,8,8,8] 1 (find land (map4 ,2,2, "S"), 2) (find land (map4),4,1, "NE"), None ) (find land(map5),7,0,"N"), 5) (find land (map1,1,1, "W", 0) (find land ([ [0,0,0,0,0,0,0,0,0,411,0,0,"E"),9) find land (m3,3,1, "SE", 1) (find land (m7,5, 5, "NW"), 4) (find land (m5, 0,5, "SW"), 2) (find land (m5, 0,6, "W"),5)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Write messages that are used for the various stages of collection.

Answered: 1 week ago

Question

Question What are the requirements for a SIMPLE 401(k) plan?

Answered: 1 week ago