answer.
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
il63 [147K]
2 years ago
9

Retype the below code. Fix the indentation as necessary to make the program work. if 'New York' in temperatures: if temperatures

['New York'] > 90: print('The city is melting!') else: print('The temperature in New York is', temperatures['New York']) else: print('The temperature in New York is unknown.') Sample output with input: 105 The city is melting!
Engineering
1 answer:
adell [148]2 years ago
4 0

Answer: Here is the indented code:

if 'New York' in temperatures:

 if temperatures['New York'] > 90:

   print('The city is melting!')

 else:

   print('The temperature in New York is', temperatures['New York'])

else:

   print('The temperature in New York is unknown.')

Explanation:

Here is the complete program:

temperatures = {

   'Seattle': 56.5,

   'New York': 105,

   'Kansas City': 81.9,

   'Los Angeles': 76.5

}

if 'New York' in temperatures:

 if temperatures['New York'] > 90:

   print('The city is melting!')

 else:

   print('The temperature in New York is', temperatures['New York'])

else:

   print('The temperature in New York is unknown.')

The output is:

The city is melting!

The program basically has nested if statements. The first If statement checks if New York is present in temperatures list. If this is true then the program control enters another if condition which checks if the temperature value of New York is greater than 90. If this evaluates to true then message The city is melting! is displayed. If this evaluates to false then else part is executed which displays the temperature in New York. If none of the above if statements evaluate to true then the final else part is executed which displays The temperature in New York is unknown. Since the value of New York temperature is set to 105 so The city is melting! is displayed in output.

Indentation in python is important as it does not uses indentation instead of using brackets to describe a block of statement. It makes the code readable. See the above nested if statements. The inner If statement is indented in such a way that it looks inside the outer if statement without the use of brackets. The else part of inner if is placed right below inner if and the else part of the outer if indented below the outer if statement. Also the print statement are indented with their corresponding if and else parts.

You might be interested in
The pump of a water distribution system is powered by a 6-kW electric motor whose efficiency is 95 percent. The water flow rate
Sonja [21]

Answer:

a) Mechanical efficiency (\varepsilon)=63.15%  b) Temperature rise= 0.028ºC

Explanation:

For the item a) you have to define the mechanical power introduced (Wmec) to the system and the power transferred to the water (Pw).

The power input (electric motor) is equal to the motor power multiplied by the efficiency. Thus, Wmec=0.95*6kW=5.7 kW.

Then, the power transferred (Pw) to the fluid is equal to the flow rate (Q) multiplied by the pressure jump \Delta P. So P_W = Q*\Delta P=0.018m^3/s * 200x10^3 Pa=3600W.

The efficiency is defined as the ratio between the output energy and the input energy. Then, the mechanical efficiency is \varepsilon=3.6kW/5.7kW=0.6315=63.15\%

For the b) item you have to consider that the inefficiency goes to the fluid as heat. So it is necessary to use the equation of the heat capacity but in a "flux" way. Calling <em>H</em> to the heat transfered to the fluid, the specif heat of the water and \rho the density of the water:

[tex]H=(5.7-3.6) kW=\rho*Q*c*\Delta T=1000kg/m^3*0.018m^3/s*4186J/(kg \ºC)*\Delta T[/tex]

Finally, the temperature rise is:

\Delta T=2100/75348 \ºC=0.028 \ºC

7 0
2 years ago
The 30-kg gear is subjected to a force of P=(20t)N where t is in seconds. Determine the angular velocity of the gear at t=4s sta
tatyana61 [14]

Answer:

\omega =\frac{24}{1.14375}=20.983\frac{rad}{s}

Explanation:

Previous concepts

Angular momentum. If we consider a particle of mass m, with velocity v, moving under the influence of a force F. The angular  momentum about point O is defined as the “moment” of the particle’s linear momentum, L, about O. And the correct formula is:

H_o =r x mv=rxL

Applying Newton’s second law to the right hand side of the above equation, we have that r ×ma = r ×F =

MO, where MO is the moment of the force F about point O. The equation expressing the rate of change  of angular momentum is this one:

MO = H˙ O

Principle of Angular Impulse and Momentum

The equation MO = H˙ O gives us the instantaneous relation between the moment and the time rate of change of angular  momentum. Imagine now that the force considered acts on a particle between time t1 and time t2. The equation MO = H˙ O can then be integrated in time to obtain this:

\int_{t_1}^{t_2}M_O dt = \int_{t_1}^{t_2}H_O dt=H_0t2 -H_0t1

Solution to the problem

For this case we can use the principle of angular impulse and momentum that states "The mass moment of inertia of a gear about its mass center is I_o =mK^2_o =30kg(0.125m)^2 =0.46875 kgm^2".

If we analyze the staritning point we see that the initial velocity can be founded like this:

v_o =\omega r_{OIC}=\omega (0.15m)

And if we look the figure attached we can use the point A as a reference to calculate the angular impulse and momentum equation, like this:

H_Ai +\sum \int_{t_i}^{t_f} M_A dt =H_Af

0+\sum \int_{0}^{4} 20t (0.15m) dt =0.46875 \omega + 30kg[\omega(0.15m)](0.15m)

And if we integrate the left part and we simplify the right part we have

1.5(4^2)-1.5(0^2) = 0.46875\omega +0.675\omega=1.14375\omega

And if we solve for \omega we got:

\omega =\frac{24}{1.14375}=20.983\frac{rad}{s}

8 0
2 years ago
Race conditions are possible in many computer systems. Consider an online auction system where the current highest bid for each
kumpel [21]

Answer:

See attached picture.

Explanation:

5 0
2 years ago
Which situation is an enabler for the rise of Artificial Intelligence (AI) in recent years?
Vladimir [108]

Explanation:

Which situation is an enabler for the rise of Artificial Intelligence (A in recent years? availability of cloud-based, hosted machine learning platforms.

8 0
2 years ago
Read 2 more answers
Fill in the Blank: The _____ has a very sturdy handle with good leverage for tightening nuts and bolts. It can be used to apply
guapka [62]

Answer:

D Rachet

Explanation:

I tightens it

8 0
2 years ago
Other questions:
  • A_____ transducer is a device that can convert an electronic controller output signal into a standard pneumatic output. A. pneum
    13·1 answer
  • How much extra water does a 21.5 ft, 175-lb concrete canoe displace compared to an ultra-lightweight 38-lb Kevlar canoe of the s
    8·1 answer
  • Determine the amount of gamma and alpha phases in a 10-kg, 1060 steel casting as it is being cooled to the following temperature
    6·1 answer
  • A 0.9% solution of NaCl is considered isotonic to mammalian cells. what molar concentration is this?
    10·1 answer
  • Consider a very long rectangular fin attached to a flat surface such that the temperature at the end of the fin is essentially t
    9·1 answer
  • g The function below takes a single string parameter: sentence. Complete the function to return everything but the middle 10 cha
    15·1 answer
  • Refrigerant-134a enters the coils of the evaporator of a refrigeration system as a saturated liquid–vapor mixture at a pressure
    5·1 answer
  • Determine the angular acceleration of the uniform disk if (a) the rotational inertia of the disk is ignored and (b) the inertia
    11·1 answer
  • technician A says that in any circuit, electrical current takes the path of least resistance. technician B says that while this
    13·1 answer
  • A dryer is shaped like a long semi-cylindrical duct of diameter 1.5 m. The base of the dryer is occupied with water-soaked mater
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!