class Solution(object):
    def islandPerimeter(self, grid):
        """
        :type grid: List[List[int]]
        :rtype: int
        """
        r = len(grid)
        c = len(grid[0])
        perimeter = 0
        for i in xrange(r):
            for j in xrange(c):
                if grid[i][j] == 1:
                    perimeter += 4
                    if i > 0 and grid[i - 1][j] == 1:
                        perimeter -= 1
                    if i < r - 1 and grid[i + 1][j] == 1:
                        perimeter -= 1
                    if j > 0 and grid[i][j - 1] == 1:
                        perimeter -= 1
                    if j < c - 1 and grid[i][j + 1] == 1:
                        perimeter -= 1
        return perimeter

Add py solution for 463. Island Perimeter
Add py solution for 463. Island Perimeter

463. Island Perimeter: https://leetcode.com/problems/island-perimeter/
