how to calculate the perimeter of an irregular polygon | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

how to calculate the perimeter of an irregular polygon

how to calculate the perimeter of an irregular polygon

11th May 2020, 9:21 PM
Jose Rodolfo Anguiano Antonio
2 Answers
+ 1
It actually depends on what data you are given with. If you are given vertices calculate the length of lines and add them. here is how you can calculate distance between (4,0) and (6,6): import math p1 = [4, 0] p2 = [6, 6] distance = math.sqrt( ((p1[0]-p2[0])**2)+((p1[1]-p2[1])**2) ) print(distance)
11th May 2020, 11:27 PM
Md. Sazzad Hossain
Md. Sazzad Hossain - avatar
0
perimeter = 0 for side_length in irregular_polygon: perimeter += side_length print(perimeter)
11th May 2020, 10:49 PM
Russ
Russ - avatar