Question: python Write a program that computes the perimeter of a polygon. Begin by reading the x and y values for the first point on the

pythonpython Write a program that computes the perimeter of a polygon. Begin

Write a program that computes the perimeter of a polygon. Begin by reading the x and y values for the first point on the perimeter of the polygon from the user. Then continue reading pairs of x and y values until the user enters a blank line for the x-coordinate. Each time you read an additional coordinate you should compute the distance to the previous point and add it to the perimeter. When a blank line is entered for the x-coordinate your program should add the distance from the last point back to the first point to the perimeter. Then it should display the total perimeter. Sample input and output is shown below, with user input shown in bold: Enter the x part of the coordinate: 0 Enter the y part of the coordinate: 0 Enter the x part of the coordinate: (blank to quit): 1 Enter the y part of the coordinate: 0 Enter the x part of the coordinate: (blank to quit): 0 Enter the y part of the coordinate: 1 Enter the x part of the coordinate: (blank to quit): The perimeter of that polygon is 3.414213562373095

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!