Let's write code that calculates the perimeter of different polygons. The code will be part of an architectural design program.