def calc_perimeter(points):
    
    if len(points) < 2: return 0
       
    p1 = points[0]
    c = 0
    for p2 in points[1:] + [points[0]]:
        c += sqrt((p2[X] - p1[X])**2 + (p2[Y] - p1[Y])**2) 
        p1 = p2
    return c

### "hidden" functions
Calculate the perimeter of a polygon
dataset/ETHPy150Open estevaofon/angry-birds-python/pymunk-4.0.0/pymunk/util.py/calc_perimeter