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
Technician A says the final drive assembly always has a gear ratio of 1:1. Technician B says the final drive assembly provides f
Olenka [21]

Answer:

Technician B only is correct

Explanation:

The last stage of gears found between the vehicle transmission system and the wheels is the final drive ratio. The function of the final drive gear assembly is to enable a gear reduction control stage to reduce the rotation per minute and increase the wheel torque, such that the vehicle performance can be adjusted and the final gear ratio can be between 3:1 and 4.5:1 not 1:1

Therefore, technician B only is correct

5 0
4 years ago
The theoretical maximum specific gravity of a mix at 5.0% binder content is 2.495. Using a binder specific gravity of 1.0, find
PSYCHO15rus [73]

Answer:

The theoretical maximum specific gravity at 6.5% binder content is 2.44.

Explanation:

Given the specific gravity at 5.0 %  binder content 2.495

Therefore

95 % mix + 5 % binder  gives S.G. = 2.495

Where the  binder is S.G. = 1, Therefore

Per 100 mass unit we have (Mx + 5)/(Vx + 5) = 2.495

(95 +5)/(Vx +5) = 2.495

2.495 × (Vx + 5) = 100

Vx =35.08 to 95

Or density of mix = Mx/Vx = 95/35.08 = 2.7081

Therefore when we have 6.5 % binder content, we get

Per 100 mass unit

93.5 Mass unit of Mx has a volume of

Mass/Density = 93.5/2.7081 = 34.526 volume units

Therefore we have

At 6.5 % binder content.

(100 mass unit)/(34.526 + 6.5) = 2.44

The theoretical maximum specific gravity at 6.5% binder content = 2.44.

3 0
3 years ago
The correct area in sq. Inches and sq. Feet is: Select one: a. 966.76 sq. Inches and 8.056 sq. Feet b. 96.676 sq. Inches and 8.0
kogti [31]

Answer:

c. 96.676 sq. Inches and 0.671 sq. Feet

Explanation:

From the list of the given option, we are told to chose the correct area in sq. inches that correspond to sq. Feet.

If we recall from the knowledge of our conversion  table that,

1 sq feet = 144 sq inches

Then, let's confirm if the option were true.

a.  966.76 sq. Inches and 8.056 sq. Feet

Assuming

if 1 sq feet = 8.056

in sq inches, we have ( 8.056 × 144 ) sq inches

= 1160.064 sq. inches

So, 1160.064 sq. inches is equal to 8.056 sq. Feet. Then option 1 is wrong

b. 96.676 sq. Inches and 8.056 sq. Feet

if 1 sq feet = 8.056

in sq inches, we have ( 8.056 × 144 ) sq inches

= 1160.064 sq. inches

So, 1160.064 sq. inches is equal to 8.056 sq. Feet. Then option 2 is wrong/

c. 96.676 sq. Inches and 0.671 sq. Feet

if 1 sq feet = 0.671

in sq inches, we have ( 0.671 × 144 ) sq inches

=  96.624 sq. Inches which is closely equal to 96.676 sq. Inches

Therefore, this is the correct answer as it proves that 96.676 sq. Inches = 0.671 sq. Feet

8 0
3 years ago
What do you own that might not be manufactured?
horrorfan [7]

Answer:

A pet

Explanation:

Latin time I checked animals aren't made by people? I honestly don't know if this helps but I'm technically not wrong.

8 0
3 years ago
The purpose of pasteurizing milk is to A. Kill pathogens B. Break down milk fat C. Add vitamins and minerals D. Prevent spoilage
motikmotik
Answer: A Kill pathogens
7 0
3 years ago
Other questions:
  • Practicing new things strains your brain fibers, weakening your ability to make connections.
    13·1 answer
  • A slight breeze is blowing over the hot tub above and yields a heat transfer coefficient h of 20 W/m2 -K. The air temperature is
    15·1 answer
  • Convection is a function of temperature to the fourth power. a)-True b)-False
    9·1 answer
  • A completely reversible heat pump produces heat ata rate of 300 kW to warm a house maintained at 24°C. Theexterior air, which is
    6·1 answer
  • A long corridor has a single light bulb and two doors with light switch at each door. design logic circuit for the light; assume
    8·1 answer
  • A train travels 650 meters in 25 seconds. What is the train's velocity?
    9·1 answer
  • Which of the following allows team members to visualize a design model from a variety of perspectives?
    12·2 answers
  • What type of engineer works to create a practical and safe energy source?
    9·1 answer
  • When you accelerate, the size of the front tire patch becomes____
    15·1 answer
  • What effect does air have on the acceleration of aircraft during flight?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!