# Write a python function to caclucate the polygon_area

## Topic: Write a python function to caclucate the polygon_area

Solution

def polygon_area( side_length, sides = 3): if(sides < 3 or sides > 6 ): raise ValueError("number of sides must be greater than 2 and less than 7") if(side_length < 0 ): raise ValueError("side length must be positive") return sides * (side_length ** 2) / (4 * tan(pi / sides))

List all Python Programs