[10 marks Write a Python function called fake_average (aList) that returns the average of the smallest...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
[10 marks Write a Python function called fake_average (aList) that returns the average of the smallest and largest values in alist. For example: take average ((2, 1, 3, 51) should return the value 3 (the average of 1 and 5) take average ((1, 1, 1, 1, 21) should return the value 1.5 (the average of 1 and 2) • take average ((5, 5, 5, 5, 5, 51) should return the value 5 (the average of 5 and 5) Submission instructions • Your program must include a comment at the top with your name and the question number. Your file name should be final_q3_INITIAL_LASTNAME.sb3 (eg., if your name is Rob Alen, your submission would be final_q3_R_Allen.py) [10 marks Write a Python function called fake_average (aList) that returns the average of the smallest and largest values in alist. For example: take average ((2, 1, 3, 51) should return the value 3 (the average of 1 and 5) take average ((1, 1, 1, 1, 21) should return the value 1.5 (the average of 1 and 2) • take average ((5, 5, 5, 5, 5, 51) should return the value 5 (the average of 5 and 5) Submission instructions • Your program must include a comment at the top with your name and the question number. Your file name should be final_q3_INITIAL_LASTNAME.sb3 (eg., if your name is Rob Alen, your submission would be final_q3_R_Allen.py)
Expert Answer:
Answer rating: 100% (QA)
This is the code to compute the average The function of the various ... View the full answer
Related Book For
Data Structures and Algorithms in Python
ISBN: 978-1118290279
1st edition
Authors: Michael T. Goodrich , Roberto Tamassia, Michael H. Goldwasser
Posted Date:
Students also viewed these databases questions
-
Write a recursive method that returns the number of 1's in the binary representation of N. Use the fact that this is equal to the number of 1's in the representation of N/2, plus 1, if N is odd.
-
Write a method that returns the index of the smallest element in an array of integers. If the number of such elements is greater than 1, return the smallest index. Use the following header: public...
-
Write a method called average that returns the average of the values in the list as a real number. For example, if a variable called list stores [11, 7, 3, 42, 0, 14], the call of list.average()...
-
Given this expression, what can we say about the problem domain? tBoat (BoatSerialNo, BoatType, Manufacturer, Price, Customer, Date Of Sales Rep) SalesRep should not be in the expression at all...
-
Identify and describe two common judgment traps.
-
Presented below are income statements prepared on a LIFO and FIFO basis for Kenseth Company, which started operations on January 1, 2024. The company presently uses the LIFO method of pricing its...
-
The Azuza Company owns no plant assets and had the following income statement for the year: Additional information about the company includes: Use the preceding information to calculate the cash flow...
-
Tempo Companys fixed budget for the first quarter of calendar year 2013 reveals the following. Prepare flexible budgets following the format of Exhibit 23.3 that show variable costs per unit, fixed...
-
A company had stock outstanding as follows during each of its first three years of operations: 1,000 shares of 10%, $100 par, cumulative preferred stock and 38,000 shares of $10 par common stock. The...
-
A store maintains data on customers, products and purchase records in three tables: CUSTOMER, PRODUCT, PURCHASE. The store manager wants to know which product is on its maximum discount for each...
-
Mr. Goldston is Chief executive officer of Omega Airlines Inc. and owns 950,000 shares of stock. The company currently has 6 million shares of stock and convertible bonds with a face value of $ 40...
-
Wildhorse Company purchased a machine at a price of $109,900 by signing a note payable, which requires a single payment of $142,324 in 3 years. Click here to view factor tables. Assuming annual...
-
29. A 50.0-kg projectile is fired at an angle of 30.0 above the horizontal with an initial speed of 1.20 x 102 m/s from the top of a cliff 142 m above level ground, where the ground is taken to be y...
-
What is your topic? Who is your target audience? Share examples of logos, pathos, and ethos you will include in the speech. What other persuasive techniques and/or appeals will you use? How will you...
-
Skater 1 (78 kg) and skater 2 (56 kg) are moving together going east. Skater 2 pushes skater 1 with a force of 64 N [W]. a) Determine the acceleration of each skater. b) What will happen to the...
-
Tamarisk Corporation donates equipment and a truck to the community Home Assistance Centre. The equipment had a cost of $110,000, accumulated depreciation to the contribution date of $51,000, and a...
-
A local, private foundation is trying to accurately measure future cash flows. It is planning to go to market with a new fundraising campaign that should generate $ 1 0 0 , 0 0 0 in revenues. But,...
-
The vapor pressure of the liquid NH, is measured at different temperatures. The following vapor pressure data are obtained. Temperature, K P, mmHg 217.1 223.4 234.7 588.1 Calculate the enthalpy of...
-
Let T be a red-black tree and let p be the position of the parent of the original node that is deleted by the standard search tree deletion algorithm. Prove that if p has one child, the deletion has...
-
Draw an adjacency list representation of the undirected graph shown in Figure 14.1.
-
Demonstrate how to use Pythons list comprehension syntax to produce the list [1, 2, 4, 8, 16, 32, 64, 128, 256].
-
The Gini coefficient, which measures income inequality, varies from _________ for perfect equality to _________ for perfect inequality.
-
Heavy taxes on the rich, combined with large subsidies for the poor, would result in little incentive to _________ or _________.
-
Large-scale redistribution from high-income individuals to low-income individuals would likely _________ the level of human capital (education) in society.
Study smarter with the SolutionInn App