1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
jarptica [38.1K]
3 years ago
8

Description: Write a function that takes in a list of numbers and a list of indices. Note that indexList may not only contain va

lid indices. The function should keep track of the number and type of errors that occur. Specifically, it should account for IndexError and TypeError . It should return the average of all the numbers at valid indices and a dictionary containing the number and type of errors together in a tuple. errorDict should be formatted as follow
Engineering
1 answer:
MAVERICK [17]3 years ago
7 0

Answer:

Python code is explained below

Explanation:

average , count, indexerror, typeerror variables are initialised to 0

Then, for loop is used to traverse the indexlist, if type is not right, typeerror is incremented, else if index is not right, indexerror is incremented, otherwise, count is incremented, and the number is added to average.

At last, average variable which contains the sum of numbers is divided by count to get average.

Here is the code:

def error_finder(numList, indexList):

average = 0

count = 0

indexerror = 0

typeerror = 0

 

for i in range(len(indexList)):

if type(indexList[i])==int:

if indexList[i]>=len(numList) or i<0:

indexerror = indexerror + 1

else:

average = average + numList[indexList[i]]

count = count+1

else:

typeerror = typeerror + 1

 

d = {"IndexError": indexerror, "TypeError":typeerror}

 

average = average/count

 

return(average, d)

print(error_finder([4, 5, 1, 7, 2, 3, 6], [0, "4", (1, ), 18, "", 3, 5.0, 7.0, {}, 20]))

You might be interested in
A double-threaded Acme stub screw of 2-in. major diameter is used in a jack having a plain thrust collar of 2.5-in. mean diamete
Temka [501]
This is the answer for the question

6 0
2 years ago
Which bulb has the lowest total cost of operation? (a) Incandescent (b) Fluorescent (c) LED
Finger [1]

Answer: LED have the lowest cost of operation.

Explanation:

If we ignore the initial procurement cost of the items the operational cost of any device consuming electricity is given by

Cost=Energy\times cost/unit

Among the three item's LED consumes the lowest power to give the same level of brightness as compared to the other 2 item's thus LED's shall have the lowest operational cost.

6 0
3 years ago
if both the ram air input and drain hole of the pitot system become blocked, the indicated airspeed will
egoroff_w [7]

If both the ram air input and drain hole of the pitot system become blocked, the indicated airspeed will: a) increase during a climb.

<h3>What is a ram air input?</h3>

A ram air input can be defined as an air intake system which is designed and developed to use the dynamic air pressure that is created due to vehicular motion, or ram pressure, in order to increase the static air pressure within the intake manifold of an internal combustion engine of an automobile.

This ultimately implies that, a ram air input allows a greater mass-flow of air through the engine of an automobile, thereby, increasing the engine's power.

In conclusion, indicated airspeed will increase during a climb when both the ram air input and drain hole of the pitot system become blocked.

Read more on pilots here: brainly.com/question/10381526

#SPJ1

Complete Question:

If both the ram air input and drain hole of the pitot system become blocked, the indicated airspeed will

a) increase during a climb

b) decrease during a climb

c) remain constant regardless of altitude change

6 0
2 years ago
Which of the following is a possible consequence of poor measurement in construction as stated in the segment?
Kamila [148]

Answer:

Decreased risk of structure failure

6 0
2 years ago
What are the general rules for press fit allowances
Keith_Richards [23]

Explanation:

As a general rule of thumb, the large the diameter of a bearing, bushing or pin, the larger the tolerance range,” Brieschke points out. “The inverse is true for smaller-diameter pieces.”

Mike Brieschke, vice president of sales at Aries Engineering, says a 0.25-inch-diameter metal dowel that is press-fit into a mild steel hole usually has an interference of ±0.0015 inch. Parts in noncritical assemblies tend to have looser tolerances

please rate brainliest if helps and follow

4 0
1 year ago
Other questions:
  • The waffle slab is: a) the two-way concrete joist framing system. b) a one-way floor and roof framing system. c) the one-way con
    11·1 answer
  • I study to get good grades because my parents want to send me to the college of my choice.” This is an a. Intrinsic motivational
    6·2 answers
  • Saturated liquid water at 150 F is put under pressure to decrease the volume by 1% while keeping the temperature constant. To wh
    8·1 answer
  • Emergency plans are being formulated so that rapid action can be taken in the event of an equipment failure. It is predicted tha
    12·2 answers
  • Please help with my economics problem
    8·1 answer
  • What is the difference between a series circuit and a parallel circuit?
    11·2 answers
  • Whats the difference between GeForce GTX 1060 and Geforce GTX 3060? Is there any big changes to FPS and other settings?
    7·2 answers
  • A __________ defines the area of land that will supply water to a stream.
    9·1 answer
  • The following is a series of questions pertaining to the NSPE Code of Ethics. Please indicate whether the statement are true or
    14·1 answer
  • Do you think that individuals with the same disabilities have the same needs? If your answer is yes, how? /No, why?​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!