Create 1. a program named shoelace_formula.py that utilizes the shoelace formula via the following steps: Create...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Create 1. a program named shoelace_formula.py that utilizes the shoelace formula via the following steps: Create a function named getpoints that takes in as an argument a string and returns a list of points of arbitrary length. The string passed to the function contains pairs of numbers separated by commas, with each pair separated by a space, as shown in the format below. Have the function convert it to a list of points (the polygon's vertices). Each element in the list of points should itself be a list of one point. For the example shown below, your function should return: [[3, 4], [5, 61, [9, 51, [12, 8], [5, 11]] 2. Create a function named cross that takes in two arguments, both of which are a list of one point, and returns the cross-product. This is one step of the shoelace method. For example, if the points [1, 2] and [3, 4] are passed to the function, in that order, it will return -2. Cross product: (1 * 4) - (2 * 3) = -2 3. Create a function named shoelace that takes in as an argument a list of points and returns the area of the polygon calculated via the shoelace formula. The list of points passed to the function is the same list returned by your getpoints function. Your shoelace function should call your cross function. 4. Create a function named main that does not take in any arguments nor return any values. This function should take as input from the user a string of pairs of numbers separated by commas and spaces, as shown in the format below, and print the area of the polygon. Your main function should call your getpoints and shoelace functions. Format your output as shown below. 5. Finally, in your main code type the following: _main_ if name main () You should NOT include any other executable lines in your main code. Example output (using input 3,4 5,6 9,5 12,8 5,11): Please enter the vertices: 3,4 5,6 9,5 12,8 5,11 The area of the polygon is 30.0 Create 1. a program named shoelace_formula.py that utilizes the shoelace formula via the following steps: Create a function named getpoints that takes in as an argument a string and returns a list of points of arbitrary length. The string passed to the function contains pairs of numbers separated by commas, with each pair separated by a space, as shown in the format below. Have the function convert it to a list of points (the polygon's vertices). Each element in the list of points should itself be a list of one point. For the example shown below, your function should return: [[3, 4], [5, 61, [9, 51, [12, 8], [5, 11]] 2. Create a function named cross that takes in two arguments, both of which are a list of one point, and returns the cross-product. This is one step of the shoelace method. For example, if the points [1, 2] and [3, 4] are passed to the function, in that order, it will return -2. Cross product: (1 * 4) - (2 * 3) = -2 3. Create a function named shoelace that takes in as an argument a list of points and returns the area of the polygon calculated via the shoelace formula. The list of points passed to the function is the same list returned by your getpoints function. Your shoelace function should call your cross function. 4. Create a function named main that does not take in any arguments nor return any values. This function should take as input from the user a string of pairs of numbers separated by commas and spaces, as shown in the format below, and print the area of the polygon. Your main function should call your getpoints and shoelace functions. Format your output as shown below. 5. Finally, in your main code type the following: _main_ if name main () You should NOT include any other executable lines in your main code. Example output (using input 3,4 5,6 9,5 12,8 5,11): Please enter the vertices: 3,4 5,6 9,5 12,8 5,11 The area of the polygon is 30.0
Expert Answer:
Answer rating: 100% (QA)
Heres the Python program that follows the specified steps python def getpointss points listmapint ... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
A corporate entity has both preferred and common classes of shares. How is the book value of common shares calculated in this case? What is meant by the liquidation value of preferred shares?
-
Find the Thevenin equivalent of the network shown at the terminals A-B. 1000 L 2KO
-
Figure 2.36 shows how the contraction velocity, v(x), of a muscle changes as the load on it changes. (a) Find the slope of the line tangent to the graph of contraction velocity at a load of 2 kg....
-
The first-order di ffraction of x rays from two crystals with simple cubic structure is measured. The first-order di ffrac tion from crystal A occurs at an angle of20. The first-order diffraction of...
-
1. In the highly competitive global footwear industry, what are the most important decisions faced by firms like Wolverine in their drive to obtain superior performance? What approaches did Wolverine...
-
Kingbird Inc. manufactures cycling equipment. Recently, the company's vice-president of operations has requested construction of a new plant to meet the increasing demand for the company's bikes....
-
Air France flight 358 aviation accident/incident Human Factors contribute to the overall event. Some Human Factors to Consider: Safety Culture /Organizations and Leadership Aviation Security...
-
1. Identify the type(s) of hubs that you would use on this network (provide a brief justificat 2. Identify the type(s) of switches that you would use on this network (provide a brief justification)....
-
A 1 0 0 . 0 k g person standing on a bathroom scale at the equator of the Earth. Calculate the scale reading given that g = 9 . 7 9 m s 2 . Include the effect of centripetal force. The radius of the...
-
Court procedures allow judges to alter jury verdicts based upon properly filed post-judgment motions. These motions include JNOV and new trial, both of which are mentioned by your authors. There are...
-
Is emotional intelligence beneficial to managers when interacting with employees from culturally diverse backgrounds? Explain.
-
The average speed of blood in aorta is 0.4 m/s and the cross section of aorta is by 3.5 % lower than the cross section of polmunary artery. calculate the average speed of blood in polmunary artery....
-
For the logistic regression, suppose we want to test HO: logit(pi(x) = Beta0 + Betal X1, versus H1: logit(pi(x) = beta0 + betalX1 + beta2 X2 using the likelihood ratio test (LRT). Under regularity...
-
Use integration by parts to evaluate the following. Check your answer by taking the derivative. x2e-xdx
-
The CandyBar structure contains three members.The first member holds the brand name of a candy bar.The second member holds the weight (which may have a fractional part) of the candy bar, and the...
-
Modify the Stock class definition (the version in stock20.h) so that it has member functions that return the values of the individual data members. A member that returns the company name should not...
-
Evaluate the following expressions as C++ would: a. 8 * 9 + 2 b. 6 * 3 / 4 c. 3 / 4 * 6 d. 6.0 * 3 / 4 e. 15 % 4
-
From the following table, calculate the variances and discuss each one in relation to the following questions: i Is the variance positive or negative in terms of business performance? ii What are the...
-
Several years ago, Catherines Cattery Supplies signed a contract to deliver 5000 units of a special product each year to one of its customers at a price of $15 per unit. This contract, which runs for...
-
The Anderson Group has identified the following capital expenditure proposals as acceptable. Only $150 000 is available for investment. Required: Determine the combination of proposals to be...
Study smarter with the SolutionInn App