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

 def find land (map, r, c, dir): Given a map and

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

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!