Question
def water_adjacent(map, r, c): Given a map and a location, are any of that spot's neighbors water? Water spots do not count themselves, only their
def water_adjacent(map, r, c): Given a map and a location, are any of that spot's neighbors water? Water spots do not count themselves, only their neighbors. If (r,c) isn't on the map, the answer is False. Assume: map is a map as defined above, and r and c are int values. water_adjacent(map1,1,1) True water_adjacent(map1,2,2) False water_adjacent([[1,1,1],[1,0,1],[1,1,1]],1,1) False
Restrictions no modules may be imported. you may only use built-in functions and methods explicitly listed below in the allowed section. list comprehensions and lambdas may not be used on this project.
Allowed basic statements, variables, operators, del, indexing, slicing, in, are all allowed any form of control flow we've covered is allowed (if/else, loops, etc) only these built-in functions: range(), len(), int(), str(), type(), list() only these built-in methods: s.split(), s.join(), s.pop(), xs.append(), xs.extend(), xs.insert(), s.format()
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started