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]
4 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]4 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 successful quality strategy features which of the following elements? engaging employees in the necessary activities to implem
Alona [7]

Answer:

Quality strategy is an integral part of organization's strategy that ensures quality. It involves market and productivity strategies that have a very high significance.  A successful quality strategy must endeavour to have features such as; engaging employees in the necessary activities to implement quality, an organizational culture that fosters quality and an understanding of the principles of quality.

All these will enable the organization to stand out and beat competition.

5 0
3 years ago
Read 2 more answers
Accenture is working with a client to improve their current security infrastructure. The client wants to redefine the security p
Zepler [3.9K]

The idea that Accenture might recommend to the client to improve their current security infrastructure is;

<u><em>To develop a long term security strategy that includes an effective risk management plan.</em></u>

  • Accenture Security is a security outfit that provides next-generation cybersecurity services in consulting to aid individuals/organizations to develop a robust cyber resilience that is very effective from the inside out.

  • Now, since the client wants to redefine the security programs, create long-term plans for effective audits, and proactively plan against future threats, It means that Accenture will have to develop a long term strategy that is also an effective risk management strategy.

Read more at; https://brainly.in/question/38123110

5 0
3 years ago
Which of the following statements about glycogen metabolism is FALSE?
Ratling [72]

Answer:

Glycogen is the primary energy source for muscle and liver cells.

Explanation:

Glycogen is a readily mobilized storage form of glucose. It is a very large, branched polymer of glucose residues that can be broken down to yield glucose molecules when energy is needed. Most of the glucose residues in glycogen are linked by α-1,4-glycosidic bonds. Branches at about every tenth residue are created by α-1,6-glycosidic bonds.

Glycogen is not as reduced as fatty acids are and consequently not as energy rich. Why do animals store any energy as glycogen? Why not convert all excess fuel into fatty acids? Glycogen is an important fuel reserve for several reasons. The controlled breakdown of glycogen and release of glucose increase the amount of glucose that is available between meals. Hence, glycogen serves as a buffer to maintain blood-glucose levels. Glycogen's role in maintaining blood-glucose levels is especially important because glucose is virtually the only fuel used by the brain, except during prolonged starvation. Moreover, the glucose from glycogen is readily mobilized and is therefore a good source of energy for sudden, strenuous activity. Unlike fatty acids, the released glucose can provide energy in the absence of oxygen and can thus supply energy for anaerobic activity.

3 0
4 years ago
What is included in the environmental impact assessment process, such as the use of geographic information systems?
IgorLugansk [536]

Answer:

The combination of GISs with associated data sources, such as remote sensing imagery, is now common in environmental monitoring and assessment. ... Using a GIS as an environmental modeling tool allows modelers to incorporate database capabilities, data visualization, and analytical tools in a single integrated environment.

Explanation:

I hope it helps...

Correct me if I'm wrong..

4 0
3 years ago
What ways are people and their communities impacted by wildfire?
skelet666 [1.2K]

Explanation:

Aren't these all correct? I mean all of these are possibilities, except for the first one and the 5th one. I'll explain them all :)

1) Destruction of wildlife habitat

This doesn't really affect people. Mainly the animals living in the wild, because their homes would get burnt down, or ruined so they need to find a new place to live.

2) Timber Industry Losses

Wildfires can lower job rates in the timber industry, which can leave people struggling, looking for a new job.

3) Transportation Shutdowns

For example, things like trains might not be able to work.

You know those large railroads that are getting held up? Those could get burnt down, or unstable, which could lead to many injuries and preventions to get somewhere.

4) Houses Burned or Damaged

This is probably one of the most well known issues of wildfire.

Because of this, a bunch of citizens might not be able to live anywhere if their home gets burned down. Some people are lucky and have family nearby they can live with, but others don't, forced to live on the streets.

5) Loss of Tourism

This issue really only effects specific people.

Only people who really have any sort of relationship with touring would feel threatened by these changes.

6) Health Problems from Breathing Smoke

Yes, this is a huge issue.

Inhaling harmful smoke can inflame your lungs and airway, causing them to swell and block oxygen. This can lead to acute respiratory distress syndrome and respiratory failure.

7) Loss of places of employment

Just like number 2, this could leave people stranded with nowhere to go. Some might have to become homeless if they can't pay rent, or buy groceries.

8) Town Buildings Burned or Damaged

Think about it-- How would you feel if your town building got burnt down? It would be a huge deal, and will take months; maybe years to rebuild.

I have no clue if I did this the way you wanted, but- here. xd

3 0
3 years ago
Other questions:
  • 9) A construction company employs 2 sales engineers. Engineer 1 does the work in estimating cost for 70% of jobs bid by the comp
    11·1 answer
  • The temperature at which all molecular motion stops is known as: a) Absolute temperature b) molecular temperature c) absolute ze
    11·1 answer
  • A cannon ball is fired with an arching trajectory such that at the highest point of the trajectory the cannon ball is traveling
    5·1 answer
  • A gas in a piston–cylinder assembly undergoes a compression process for which the relation between pressure and volume is given
    10·1 answer
  • Chemical compounds that are created by a string or smaller repeating units are
    8·2 answers
  • "How would you direct traffic in the result of a catastrophic earthquake?"
    13·2 answers
  • what is the expected life 1 inch diameter bar machined from AISI 1020 CD Steel is subjected to alternating bending stress betwee
    9·1 answer
  • In software engineering how do you apply design for change?
    13·1 answer
  • Affect the amount and rate the alcohol reaches the<br> bloodstream.
    10·1 answer
  • write a paragraph on how iron and copper(separately) is manufactured, what it consists of and processes that it went through to
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!