1. The program first asks for total number of triangles 'n' user wants to calculate area...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
1. The program first asks for total number of triangles 'n' user wants to calculate area of. 2. Then using a loop, the program will ask to enter three sides for each triangle. The loop runs 'n' number of times. 3. Once three sides are provided for one triangle, the program calls a user defined function 'calculate_area' which calculates the 'area' and returns the value to the main function. 4. The main function prints the area of the triangle using str.format() and appends the 'area' to a list named 'areas'. 5. At the end of the program, it prints the largest area from the 'areas' list. max() is a built-in function which takes a list of numbers as parameter and returns the largest number from the list. 6. For this lab, you are expected to define two user-defined functions: a. calculate_area(): to calculate the area of the triangle. This function will take three sides of a triangle as parameter and returns the area of the triangle. To calculate the area of the triangle you use the following given formula. For area calculation you need to use exponential operator as x* *0.5 to calculate square root of x. b. main() function: This function organizes main functionality of the code. i. It will ask for total number of triangles 'n', ii. run a loop for 'n' number of times, iii. ask for three sides for each triangle, iv. call calculate_area() function, v. prints the 'area' returned by calculate_area(), vi. append the 'area' to 'areas' list and vii. then at the end of the program prints the largest area Heron's Formula S = A+B+C Area =S(S-A)(S-B) (S-C) C malwarehouse.com 1. The program first asks for total number of triangles 'n' user wants to calculate area of. 2. Then using a loop, the program will ask to enter three sides for each triangle. The loop runs 'n' number of times. 3. Once three sides are provided for one triangle, the program calls a user defined function 'calculate_area' which calculates the 'area' and returns the value to the main function. 4. The main function prints the area of the triangle using str.format() and appends the 'area' to a list named 'areas'. 5. At the end of the program, it prints the largest area from the 'areas' list. max() is a built-in function which takes a list of numbers as parameter and returns the largest number from the list. 6. For this lab, you are expected to define two user-defined functions: a. calculate_area(): to calculate the area of the triangle. This function will take three sides of a triangle as parameter and returns the area of the triangle. To calculate the area of the triangle you use the following given formula. For area calculation you need to use exponential operator as x* *0.5 to calculate square root of x. b. main() function: This function organizes main functionality of the code. i. It will ask for total number of triangles 'n', ii. run a loop for 'n' number of times, iii. ask for three sides for each triangle, iv. call calculate_area() function, v. prints the 'area' returned by calculate_area(), vi. append the 'area' to 'areas' list and vii. then at the end of the program prints the largest area Heron's Formula S = A+B+C Area =S(S-A)(S-B) (S-C) C malwarehouse.com
Expert Answer:
Answer rating: 100% (QA)
import math def calculateareaa b c Function that takes 3 sides of the triangle and calculates and re... View the full answer
Related Book For
Systems Analysis And Design
ISBN: 978-1119496489
7th Edition
Authors: Alan Dennis, Barbara Wixom, Roberta M. Roth
Posted Date:
Students also viewed these programming questions
-
For an ideal gas, what is the pressure in atm if the volume of the container is 5000 mL, the mol quantity is 0.812 mol, and the temperature is 28 degrees Celsius? PV = nRT (qu - A) (BA/MA + d) = nRT
-
Formulate a single python program that contains the following functions. Function 1: A function called frame_this which takes a list of words as a parameter (list_of_words) and then prints those...
-
You are required to write a Python program that will manage character (heroes and villain) information. Character (hero and villain) information will be stored in a text file that will be read in...
-
Consider a dynamic array where the capacity doubles when additional space is needed and shrinks by 50% when the size falls below 1/4 capacity. What will be the amortized big-O of an append()...
-
(a) Find the slope of the tangent line to the curve y = 9 2x2 at the point (2, 1). (b) Find an equation of this tangent line.
-
An initial investment of $1,000 in an account grows to $1,477.46 at the end of eight years. If the annually compounded interest rate is unchanged over the life of the investment, What is the annual...
-
Use the closeness ratings before the activity (CloseBefore) to estimate the mean closeness rating one person would assign to others in a group. Use data from a study designed to examine the effect of...
-
On July 27, 20X0, Arthur Ward, CPA, issued an unqualified audit report on the financial statements of Dexter Company for the year ended June 30, 20X0. Two weeks later, Dexter Company mailed annual...
-
One possible waste product of a nuclear reactor is the nuclide caesium-137 which decays to form a nuclide of barium (Ba). a) State the nuclear equation for this decay. b) State three quantities that...
-
Kalogridis Corp. manufactures industrial dye. The company is preparing its 2011 master budget and has presented you with the following information: a. The projected December 31, 2010, balance sheet...
-
Consider the biosensor device shown in the figure below. The biosensor is designed to measure the concentration of solute A in the well-mixed liquid phase. At the base of the decice is an electrode...
-
Why and how will you monitor and adjust the implementation?
-
What steps are taken to derive the organization structure?
-
What are the key steps in relation to benefits when handing the project over to the business?
-
How can Innovate workshops be structured?
-
What is a benefit delivery matrix and how does it assist in the benefits realization?
-
multiple choices 1. Why should an entrepreneur do a feasibility study forstarting a new venture? . To identify possible sources of funds . To see if there are possible barriers to success . To...
-
If (x) 0 on the interval [a, b], the definite integral gives the exact area under the curve between x = a and x = b.
-
What is the purpose of the inputs and outputs section of the use case?
-
Suppose that you are the analyst charged with developing a new system for the university bookstore with which students can order books online and have them delivered to their dorms and off-campus...
-
Describe the principal steps in the implementation phase. What are the major deliverables?
-
Describe the process of determining a nominal interest rate.
-
How does risk affect the financial management of sport organizations?
-
Of MLB, the NBA, and the NHL, which league has the most risk, and which has the least? Why?
Study smarter with the SolutionInn App