6. Write a function perimeter (poly) which finds the perimeter of a polygon, where the input...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
6. Write a function perimeter (poly) which finds the perimeter of a polygon, where the input argument poly is a list of tuples, each tuple being the (x, y) coordinates of a point on the polygon. The perimeter is the sum of the distances from one point to the next, including the distance from the last point to the first. The distance between (x1, y1) and (x2, y2) is: sqrt( (x2-x1) ** 2 + (y2-y1) ** 2) Try your function on a square, a rectangle, and a triangle, where you know what the answer should be. 6. Write a function perimeter (poly) which finds the perimeter of a polygon, where the input argument poly is a list of tuples, each tuple being the (x, y) coordinates of a point on the polygon. The perimeter is the sum of the distances from one point to the next, including the distance from the last point to the first. The distance between (x1, y1) and (x2, y2) is: sqrt( (x2-x1) ** 2 + (y2-y1) ** 2) Try your function on a square, a rectangle, and a triangle, where you know what the answer should be.
Expert Answer:
Related Book For
Posted Date:
Students also viewed these programming questions
-
Q1. You have identified a market opportunity for home media players that would cater for older members of the population. Many older people have difficulty in understanding the operating principles...
-
CANMNMM January of this year. (a) Each item will be held in a record. Describe all the data structures that must refer to these records to implement the required functionality. Describe all the...
-
Krell Industries has a share price of $22 46 today. If Krell is expected to pay a dividend of S0.83 this year, and its stock price is expected to grow to $24.11 at the end of the year, what is...
-
A lever of negligible weight is loosely fitted onto a 30-mmradius fixed shaft as shown. Knowing that a force P of magnitude 275 N will just start the lever rotating clockwise, determine (a) The...
-
What is the present value of a security that will pay $10,000 in 5 years if securities of equal risk pay 3.5% annually? What is the present value of a security that will pay $3,000 in 10 years if...
-
A distillation tower is needed to separate an equimolar mixture at \(77^{\circ} \mathrm{F}\) and \(1 \mathrm{~atm}\) of benzene from styrene. The distillate should contain \(99 \mathrm{~mol} \%\)...
-
LLB Industries borrowed $200,000 from Trust Bank by issuing a two-year, 10% note, with interest payable quarterly. LLB entered into a two-year interest rate swap agreement on January 1, 2011 and...
-
For the circuit in Figure Q4, determine the following: a) R1 b) l c) l d) IRZ Vs 40 V XL2 m 75 R w 47 XL3 A m 45 R B w 68 XLI 100 tot Question 05: a) Find it through is in the circuit in Figure 5a....
-
The April 30, 2020, bank statement for Comet Company showed a cash balance of $7,582. The Cash account in the companys general ledger (G/L), according to the companys records on April 30, had a...
-
A firm had two departments, cloth and ready-made clothes. The clothes were made by the firm itself out of cloth supplied by the cloth department at its usual selling price. From the following figures...
-
Variances are not an end in themselves. In the light of the above statement, explain briefly what you understand by variances control and responsibility?
-
Fill in the following blanks. In some cases choices are provided. (i) Responsibility accounting focuses on ______________________. (ii) _______________is a sub-unit of an organisation under the...
-
Why is ROI classified as a composite performance measure? Explain its significance.
-
What are the two approaches to disposing off variances? Which will be preferred, when, and why? Take suitable examples to support your viewpoint.
-
Briefly differentiate expense centres, profit centres and investment centres. Identify the basic characteristics of each.
-
Penne Pharmaceuticals sold 3 million shares of its $5 par common stock to provide funds for research and development. If the issue price is $17 per share, what is the journal entry to record the sale...
-
Without solving, determine the character of the solutions of each equation in the complex number system. 3x 2 3x + 4 = 0
-
The vibrations of the body of a helicopter due to the periodic force applied by the rotation of the rotor can be modeled by a frictionless spiring-mass-da system subjected to an external periodic...
-
Plot the function f(x) = x2/2 + sinx + x4 for -4 < x < 4.
-
In the triangle shown a = 5 in., b = 7 in., and y = 25°. Define a, b, and y as variables, and then: (a) Calculate the length of c by substituting the variables in the Law of Cosines. (Law of...
-
If unexpected increases in the growth rate of the money supply can increase real GDP, why doesnt the Fed follow a policy of unexpectedly increasing the money supply to increase the growth of real GDP?
-
Draw an aggregate demand and supply diagram for each theory of macroeconomics. Use the diagrams to explain how the government can influence equilibrium real GDP and prices.
-
What, if any, similarities are there among the theories of economics discussed in this chapter regarding the use of fiscal and monetary policies to stimulate real GDP?
Study smarter with the SolutionInn App