So basically I have to find the smallest number in a nested list as compared to the numbers around it. This would be called a 'sink' and the function returns True if it is a sink and False if it isn't. For example, if the nested list is
[[1, 2, 1],
[4, 6, 5],
[7, 8, 9]]
then the number at [0,2], (1), should be true as all the values adjacent to it are smaller than 1 but the number at [2, 0], (7), shouldn't be true as it is greater than some of the values around it.
I tried to use slicing to get the numbers beside it but I don't know how to slice it to get the number diagonal from the sink or above or below. This is some of the code that I tried to do:
for x in elevation_map:
for xs in x:
if elevation_map[cell[0]][cell[1]] < xs[cell[0]]:
return True
return False