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
Nady [450]
3 years ago
10

4.10.1: Simon says. "Simon Says" is a memory game where "Simon" outputs a sequence of 10 characters (R, G, B, Y) and the user mu

st repeat the sequence. Create a for loop that compares the two strings starting from index 0. For each match, add one point to userScore. Upon a mismatch, exit the loop using a break statement. Assume simonPattern and userPattern are always the same length. Ex: The following patterns yield a userScore of 4: simonPattern: RRGBRYYBGY userPattern: RRGBBRYBGY
Engineering
1 answer:
AleksandrR [38]3 years ago
5 0

Answer:

for  i  in range(0,10):

   if SimonPattern[i] == UserPattern[i]:

       score = score + 1

       i = i + 1

   else:

       break

if i == 9:

   score = score + 1    

print("Total Score: {}".format(score))

Explanation:

This for loop was made using Python. Full code attached.

  • For loop requires a range of numbers to define the end points. For this Simon Says game, we are talking about 10 characters, so that must be the range for the for loop: from 0 to 10.
  • Conditional if  tests if Simon pattern matches User's one characheter by one and add point for each match.
  • Break statement is ready to escape the for loop at first mismatch.
  • As we are starting from index 0, if the users matched all the characters correctly, then we need to add 1, otherwise the maximun score would be 9 and it should be 10.
Download txt
You might be interested in
A 1-kW electric resistance heater submerged in 10-kg water is turned on and kept on for 15 min. During the process, 400 kJ of he
hichkok12 [17]

Answer:

ΔT=  11.94 °C

Explanation:

Given that

mass of water = 10 kh

Time t= 15 min

Heat lot from water = 400  KJ

Heat input to the water = 1  KW

Heat input the water= 1 x 15 x 60

                                =900 KJ

By heat balancing

Heat supply - heat rejected = Heat gain by water

As we know that heat capacity of water

C_p=4.187 \frac{KJ}{kg-K}

Q=mC_p\Delta T

Now by putting the values

900 - 400 = 10 x 4.187 x ΔT

So  rise in temperature of water ΔT=  11.94 °C

6 0
3 years ago
Explain why the failure of a garden hose occurred near its end and why the tear occurred along its length. Use numerical values
Nataliya [291]

Answer:

Most hydraulic systems develops pressure surges that may surpass settings valve. by exposing the hose surge to pressure above the maximum operating pressure will shorten the hose life.

Explanation:

Solution

Almost all hydraulic systems creates pressure surges that may exceed relief valve settings. exposing the hose surge to pressure above the maximum operating  pressure shortens the hose life.

In systems where pressure peaks are severe, select or pick a hose with higher maximum operating  pressure or choose a spiral reinforced hose specifically designed for severe pulsing applications.

Generally, hoses are designed or created to accommodate pressure surges and have operating pressures that is equal to 25% of the hose minimum pressure burst.

7 0
3 years ago
Water vapor at 10bar, 360°C enters a turbine operatingat steady state with a volumetric flow rate of 0.8m3/s and expandsadiabati
Artyom0805 [142]

Answer:

A) W' = 178.568 KW

B) ΔS = 2.6367 KW/k

C) η = 0.3

Explanation:

We are given;

Temperature at state 1;T1 = 360 °C

Temperature at state 2;T2 = 160 °C

Pressure at state 1;P1 = 10 bar

Pressure at State 2;P2 = 1 bar

Volumetric flow rate;V' = 0.8 m³/s

A) From table A-6 attached and by interpolation at temperature of 360°C and Pressure of 10 bar, we have;

Specific volume;v1 = 0.287322 m³/kg

Mass flow rate of water vapour at turbine is defined by the formula;

m' = V'/v1

So; m' = 0.8/0.287322

m' = 2.784 kg/s

Now, From table A-6 attached and by interpolation at state 1 with temperature of 360°C and Pressure of 10 bar, we have;

Specific enthalpy;h1 = 3179.46 KJ/kg

Now, From table A-6 attached and by interpolation at state 2 with temperature of 160°C and Pressure of 1 bar, we have;

Specific enthalpy;h2 = 3115.32 KJ/kg

Now, since stray heat transfer is neglected at turbine, we have;

-W' = m'[(h2 - h1) + ((V2)² - (V1)²)/2 + g(z2 - z1)]

Potential and kinetic energy can be neglected and so we have;

-W' = m'(h2 - h1)

Plugging in relevant values, the work of the turbine is;

W' = -2.784(3115.32 - 3179.46)

W' = 178.568 KW

B) Still From table A-6 attached and by interpolation at state 1 with temperature of 360°C and Pressure of 10 bar, we have;

Specific entropy: s1 = 7.3357 KJ/Kg.k

Still from table A-6 attached and by interpolation at state 2 with temperature of 160°C and Pressure of 1 bar, we have;

Specific entropy; s2 = 8.2828 KJ/kg.k

The amount of entropy produced is defined by;

ΔS = m'(s2 - s1)

ΔS = 2.784(8.2828 - 7.3357)

ΔS = 2.6367 KW/k

C) Still from table A-6 attached and by interpolation at state 2 with s2 = s2s = 8.2828 KJ/kg.k and Pressure of 1 bar, we have;

h2s = 2966.14 KJ/Kg

Energy equation for turbine at ideal process is defined as;

Q' - W' = m'[(h2 - h1) + ((V2)² - (V1)²)/2 + g(z2 - z1)]

Again, Potential and kinetic energy can be neglected and so we have;

-W' = m'(h2s - h1)

W' = -2.784(2966.14 - 3179.46)

W' = 593.88 KW

the isentropic turbine efficiency is defined as;

η = W_actual/W_ideal

η = 178.568/593.88 = 0.3

8 0
3 years ago
A vertical piston-cylinder device initially contains 0.2 m3 of air at 20°C. The mass of the piston is such that it maintains a c
Ann [662]

Answer:

Amount of air left in the cylinder=m_{2}=0.357 Kg

The amount of heat transfer=Q=0

Explanation:

Given

Initial pressure=P1=300 KPa

Initial volume=V1=0.2m^{3}

Initial temperature=T_{1}=20 C

Final Volume=V_{2}=0.1 m^{3}

Using gas equation

m_{1}=((P_{1}*V_{1})/(R*T_{1}))

m1==(300*0.2)/(.287*293)

m1=0.714 Kg

Similarly

m2=(P2*V2)/R*T2

m2=(300*0.1)/(0.287*293)

m2=0.357 Kg

Now calculate mass of air left,where me is the mass of air left.

me=m2-m1

me=0.715-0.357

mass of air left=me=0.357 Kg

To find heat transfer we need to apply energy balance equation.

Q=(m_{e}*h_{e})+(m_{2}*h_{2})-(m_{1}*h_{1})

Where me=m1-m2

And as the temperature remains constant,hence the enthalpy also remains constant.

h1=h2=he=h

Q=(me-(m1-m2))*h

me=m1-me

Thus heat transfer=Q=0

6 0
3 years ago
Explain how voltage level are interpreted by a digital circuit ​
lisabon 2012 [21]

Answer:

  the state of the circuit is a function of the voltage level. The interpretation is up to the user.

Explanation:

A binary digital circuit adopts one of two states, depending on whether the voltage level is above or below some threshold that depends on the design of the circuit. Within each state, the voltage may have some typical range. When the voltage is near the threshold, the state of the circuit may actually be "indeterminate".

The internal/output voltage is a function of the state of the circuit. The interpretation of that voltage as a true/false or 1/0 or other meaning is up to the user of the circuit.

The circuit interprets a given input voltage as intending to convey a particular input signal state according to the circuit specifications. Input voltages near the threshold between states may cause unexpected or even destructive results.

__

In order to conserve space, some digital circuits use more than 2 different voltage levels to signify more than 2 different states.

5 0
3 years ago
Other questions:
  • An aluminium alloy tube has a length of 750 mm at a temperature of 223°C. What will be its length at 23°C if its coefficient of
    7·1 answer
  • A square-thread power screw has a major diameter of 32 mm and a pitch of 4 mm with single threads, and it is used to raise a loa
    8·1 answer
  • Air at 27°C, 1 atm flows parallel to a flat plate, which is electronically heated. The plate is 0.5 m long in the direction of f
    8·1 answer
  • The ventilating fan of the bathroom of a building has a volume flow rate of 32 L/s and runs continuously. If the density of air
    7·1 answer
  • What type of intersection is this?
    8·1 answer
  • Steven is starting a project that requires a specialized, experienced contractor. Which selection process is the most suitable f
    11·1 answer
  • What document should you have from the engine manufacturer when working on an engine
    8·1 answer
  • Alguém para conversa
    13·1 answer
  • What do you mean by overflow and underflow error in array?.
    11·1 answer
  • What is shown in the above figure
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!