Answer:
Check the explanation
Explanation:
The loop invariant has to satisfy some amount of requirements to be of good use. Another complex factor as to why a loop is the question of loop termination. A loop that doesn’t terminate can’t invariably be correct, and in fact the computation in whatever form amounts to nothing. The total axiomatic description of a while construct will have to involve all of the following to be true, in which I is the loop invariant:
P => I
{I and B} S {I}
(I and (not B)) => Q
Then the loop terminates
Answer:
- def median(l):
- if(len(l) == 0):
- return 0
- else:
- l.sort()
- if(len(l)%2 == 0):
- index = int(len(l)/2)
- mid = (l[index-1] + l[index]) / 2
- else:
- mid = l[len(l)//2]
- return mid
-
- def mode(l):
- if(len(l)==0):
- return 0
-
- mode = max(set(l), key=l.count)
- return mode
-
- def mean(l):
- if(len(l)==0):
- return 0
- sum = 0
- for x in l:
- sum += x
- mean = sum / len(l)
- return mean
-
- lst = [5, 7, 10, 11, 12, 12, 13, 15, 25, 30, 45, 61]
- print(mean(lst))
- print(median(lst))
- print(mode(lst))
Explanation:
Firstly, we create a median function (Line 1). This function will check if the the length of list is zero and also if it is an even number. If the length is zero (empty list), it return zero (Line 2-3). If it is an even number, it will calculate the median by summing up two middle index values and divide them by two (Line 6-8). Or if the length is an odd, it will simply take the middle index value and return it as output (Line 9-10).
In mode function, after checking the length of list, we use the max function to estimate the maximum count of the item in list (Line 17) and use it as mode.
In mean function, after checking the length of list, we create a sum variable and then use a loop to add the item of list to sum (Line 23-25). After the loop, divide sum by the length of list to get the mean (Line 26).
In the main program, we test the three functions using a sample list and we shall get
20.5
12.5
12
Answer:
rafter is a structural component that is used as part of a roof construction. There are also different types of rafters
Answer:
V=33.66 m/s
![Re=448.8\times 10^6](https://tex.z-dn.net/?f=Re%3D448.8%5Ctimes%2010%5E6)
Re>4000, The flow is turbulent flow.
Explanation:
Given that
Pressure difference = 50 mm of Hg
We know that density of Hg=136000![Kg/m^3](https://tex.z-dn.net/?f=Kg%2Fm%5E3)
ΔP= 13.6 x 1000 x 0.05 Pa
ΔP=680 Pa
Diameter of tunnel = 200 mm
Property of air at 25°C
ρ=1.2![Kg/m^3](https://tex.z-dn.net/?f=Kg%2Fm%5E3)
Dynamic viscosity
![\mu =1.8\times 10^{-8}\ Pa.s](https://tex.z-dn.net/?f=%5Cmu%20%3D1.8%5Ctimes%2010%5E%7B-8%7D%5C%20Pa.s)
Velocity of fluid given as
![V=\sqrt{\dfrac{2\Delta P}{\rho_{air}}}](https://tex.z-dn.net/?f=V%3D%5Csqrt%7B%5Cdfrac%7B2%5CDelta%20P%7D%7B%5Crho_%7Bair%7D%7D%7D)
![V=\sqrt{\dfrac{2\times 680}{1.2}}](https://tex.z-dn.net/?f=V%3D%5Csqrt%7B%5Cdfrac%7B2%5Ctimes%20680%7D%7B1.2%7D%7D)
V=33.66 m/s
Reynolds number
![Re=\dfrac{\rho _{air}Vd}{\mu }](https://tex.z-dn.net/?f=Re%3D%5Cdfrac%7B%5Crho%20_%7Bair%7DVd%7D%7B%5Cmu%20%7D)
![Re=\dfrac{1.2\times 33.66\times 0.2}{1.8\times 10^{-8}}](https://tex.z-dn.net/?f=Re%3D%5Cdfrac%7B1.2%5Ctimes%2033.66%5Ctimes%200.2%7D%7B1.8%5Ctimes%2010%5E%7B-8%7D%7D)
![Re=448.8\times 10^6](https://tex.z-dn.net/?f=Re%3D448.8%5Ctimes%2010%5E6)
Re>4000,So the flow is turbulent flow.
Answer:
a) 8660 and 8640 alloys
b) 8660 alloy
Explanation:
Diameter of a cylindrical piece of steel = 75 mm ( 3 in )
Equivalent distance from quenched end for the center position is about 17 mm
a) If the quenching medium is moderately agitated water the alloys that will qualify are : 8660 and 8640 alloys because these are the two alloys that would have a minimum of 40 HRC at the center and also throughout the cylinder
b) if the quenching medium is a moderately agitated oil the alloy that will qualify is : 8660 alloy . because it is the only alloy that will maintain a minimum of 40 HRC at the center and also throughout the entire cylinder.