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
About what thickness of aluminum is needed to stop a beam of (a) 2.5-MeV electrons, (b) 2.5-MeV protons, and (c) 10-MeV alpha pa
Nana76 [90]

The thickness of aluminium needed to stop the beam electrons, protons and alpha particles at the given dfferent kinetic energies is 1.5 x 10⁻¹⁴ m.

<h3>Thickness of the aluminum</h3>

The thickness of the aluminum can be determined using from distance of closest approach of the particle.

K.E = \frac{2KZe^2}{r}

where;

  • Z is the atomic number of aluminium  = 13
  • e is charge
  • r is distance of closest approach = thickness of aluminium
  • k is Coulomb's constant = 9 x 10⁹ Nm²/C²
<h3>For 2.5 MeV electrons</h3>

r = \frac{2KZe^2}{K.E} \\\\r = \frac{2 \times 9\times 10^9 \times 13\times (1.6\times 10^{-19})^2}{2.5 \times 10^6 \times 1.6 \times 10^{-19}} \\\\r = 1.5 \times 10^{-14} \ m

<h3>For 2.5 MeV protons</h3>

Since the magnitude of charge of electron and proton is the same, at equal kinetic energy, the thickness will be same. r = 1.5 x 10⁻¹⁴ m.

<h3>For 10 MeV alpha-particles</h3>

Charge of alpah particle = 2e

r = \frac{2KZe^2}{K.E} \\\\r = \frac{2 \times 9\times 10^9 \times 13\times (2 \times 1.6\times 10^{-19})^2}{10 \times 10^6 \times 1.6 \times 10^{-19}} \\\\r = 1.5 \times 10^{-14} \ m

Thus, the thickness of aluminium needed to stop the beam electrons, protons and alpha particles at the given dfferent kinetic energies is 1.5 x 10⁻¹⁴ m.

Learn more about closest distance of approach here: brainly.com/question/6426420

7 0
2 years ago
A 14 inch diameter pipe is decreased in diameter by 2 inches through a contraction. The pressure entering the contraction is 28
Delicious77 [7]

Answer:

5984.67N

Explanation:

A 14 inch diameter pipe is decreased in diameter by 2 inches through a contraction. The pressure entering the contraction is 28 psi and a pressure drop of 2 psi occurs through the contraction if the upstream velocity is 4.0 ft/sec. What is the magnitude of the resultant force (lbs) needed to hold the pipe in place?

from continuity equation

v1A1=v2A2

equation of continuity

v1=4ft /s=1.21m/s

d1=14 inch=.35m

d2=14-2=0.304m

A1=pi*d^2/4

0.096m^2

a2=0.0706m^2

from continuity once again

1.21*0.096=v2(0.07)

v2=1.65

force on the pipe

(p1A1- p2A2) + m(v2 – v1)

from bernoulli

p1 + ρv1^2/2 = p2 + ρv2^2/2

difference in pressure or pressure drop

p1-p2=2psi

13.789N/m^2=rho(1.65^2-1.21^2)/2

rho=21.91kg/m^3

since the pipe is cylindrical

pressure is egh

13.789=21.91*9.81*h

length of the pipe is

0.064m

AH=volume of the pipe(area *h)

the mass =rho*A*H

0.064*0.07*21.91

m=0.098kg

(193053*0.096- 179263.6* 0.07) + 0.098(1.65 – 1.21)

force =5984.67N

4 0
3 years ago
What gadgets are charge coupled devices used in?
Alinara [238K]

Answer:

They are used in imaging application gadgets such as video cameras,TV, surveillance cameras and document scanners

Explanation:

A charge couple device (CCDs) are highly capable in imagery detector.Its common application is in video and digital imaging.The quality of a charge couple device is determined by factors such as the dynamic range, dark charge level and the quantum efficiency.These devices serve the purpose of detecting optical images though some are installed with applications for data storage.

5 0
3 years ago
Chlorine is one of the important commodity chemicals for the global economy. Before the advent of large scale
artcher [175]

The composition of gas in the feed, the percentage conversion and the

theoretical yield are combined to give the product stream composition.

Response:

The composition of gas in the product stream are;

  • HCl: 0.4 kmol/h, Cl₂: 1.6 kmol/h, H₂O: 1.6 kmol/h, O₂: 0.5 kmol/h

<h3>How can percentage conversion give the contents of the product stream?</h3>

The amount of oxygen used = 30% exceeding the theoretical amount

Number of moles of hydrochloric acid = 4 kmol/h

Percentage conversion = 80%

Required:

The composition of the gas in the product feed.

Solution;

The given reaction is; 4HCl + O₂ \longrightarrow 2Cl₂ + 2H₂O

Percentage \ conversion = \mathbf{ \dfrac{Moles \ of \ limiting \ reactant \ reacted}{Moles \  of \ limiting \ reactant \ supplied \ in \ the \, feed}}

Which gives;

80 \% = \mathbf{ \dfrac{Moles \ of \ limiting \ reactant \ reacted}{4 \, kmol/h}}

Moles of limiting reactant reacted = 4 kmol/h × 0.80 = 3.6 kmol/h

Which gives;

Number of moles of HCl in the stream = 4 kmol/h - 3.6 kmol/h = 0.4 kmol/h

Number of moles of Cl₂ produced = 2 kmol/h × 0.8 = 1.6 kmol/h

Similarly;

Number of moles of H₂O produced = 2 kmol/h × 0.8 = 1.6 kmol/h

Number of moles of O₂ in the product stream = 30% × 1 kmol/h + 20% × 1 kmol/h = 0.5 kmol/h

The composition of the production stream is therefore;

  • <u>HCl: 0.4 kmol/h</u>
  • <u>Cl₂: 1.6 kmol/h</u>
  • <u>H₂O: 1.6 kmol/h</u>
  • <u>O₂: 0.5 kmol/h</u>

Learn more about theoretical and actual yield here:

brainly.com/question/14668990

brainly.com/question/82989

7 0
3 years ago
Question 21(Multiple Choice
Katen [24]

Answer:

four seconds

Explanation:

lookin at a vehicle respectively at a second can cause accident

8 0
3 years ago
Read 2 more answers
Other questions:
  • The uniform dresser has a weight of 90 lb and rests on a tile floor for which the coefficient of static friction is 0.25. If the
    6·1 answer
  • As of January 1, 2018, Farley Co. had a credit balance of $534,000 in its allowance for uncollectible accounts. Based on experie
    10·1 answer
  • Which one of the following is a list of devices from least efficient to most efficient
    9·1 answer
  • The acceleration of a point is given. a = 20 t m/s2 When t=0, s = 50 m and v = -8 m/s. What are the position and velocity of the
    13·1 answer
  • A long rod of 60-mm diameter and thermophysical properties rho=8000 kg/m^3, c=500J/kgK, and k=50 W/mK is initally at a uniform t
    8·1 answer
  • (25) Consider the mechanical system below. Obtain the steady-state outputs x_1 (t) and x_2 (t) when the input p(t) is the sinuso
    9·1 answer
  • Water flows around a 6-ft diameter bridge pier with a velocity of 12 ft/s. Estimate the force (per unit length) that the water e
    8·1 answer
  • This is various straps secured on a worker to distribute the fall arrest forces. What is depicted in the image?
    6·2 answers
  • Safety-in engineering as with everything else is all about trying to maximize or create the hazards involved with what you are d
    6·2 answers
  • At a retirement party, a coworker described terry as dedicated
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!