height = [[3, 6, 2, 8], [7, 3, 4, 2], [8, 6, 7, 3], [5, 3, 2, 9]]
tu = [(0,-1),(0,1),(-1,0),(1,0)]
temp = []

count = 0
for y in range(4):
    for x in range(4):
        temp.clear()
        current = height[y][x]
        temp.append(current)
        for dx, dy in tu:
            nx = x + dx
            ny = y + dy
            if 0 <= nx < 4 and 0 <=ny < 4:
                temp.append(height[ny][nx])

        if current == min(temp):
            count += 1  
                
print(count)
            

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: