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 well-insulated tank in a vapor power plant operates at steady state. Saturated liquid water enters at inlet 1 at a rate of 125
Gekata [30.6K]

Answer:

a) \dot m_{3} = 135\,\frac{lbm}{s}, b) h_{3}=168.965\,\frac{BTU}{lbm}, c) T = 200.829\,^{\textdegree}F

Explanation:

a) The tank can be modelled by the Principle of Mass Conservation:

\dot m_{1} + \dot m_{2} - \dot m_{3} = 0

The mass flow rate exiting the tank is:

\dot m_{3} = \dot m_{1} + \dot m_{2}

\dot m_{3} = 125\,\frac{lbm}{s} + 10\,\frac{lbm}{s}

\dot m_{3} = 135\,\frac{lbm}{s}

b) An expression for the specific enthalpy at outlet is derived from the First Law of Thermodynamics:

\dot m_{1}\cdot h_{1} + \dot m_{2} \cdot h_{2} - \dot m_{3}\cdot h_{3} = 0

h_{3} = \frac{\dot m_{1}\cdot h_{1}+\dot m_{2}\cdot h_{2}}{\dot m_{3}}

Properties of water are obtained from tables:

h_{1}=180.16\,\frac{BTU}{lbm}

h_{2}=28.08\,\frac{BTU}{lbm} + \left(0.01604\,\frac{ft^{3}}{lbm}\right)\cdot (14.7\,psia-0.25638\,psia)

h_{2}=29.032\,\frac{BTU}{lbm}

The specific enthalpy at outlet is:

h_{3}=\frac{(125\,\frac{lbm}{s} )\cdot (180.16\,\frac{BTU}{lbm} )+(10\,\frac{lbm}{s} )\cdot (29.032\,\frac{BTU}{lbm} )}{135\,\frac{lbm}{s} }

h_{3}=168.965\,\frac{BTU}{lbm}

c) After a quick interpolation from data availables on water tables, the final temperature is:

T = 200.829\,^{\textdegree}F

8 0
3 years ago
Read 2 more answers
Technician A says that the definition of torque is how far the crankshaft twists in degrees.Technician B says that torque can re
leonid [27]
Technician B is correct because torque is a force of an object.
6 0
11 months ago
Re armature of a 4 pole DC generator is required to generate an emf of 520v on open circuit when revolving at a speed of 660rpm.
bija089 [108]

Since the armature is wave wound, the magnetic flux per pole is 0.0274 Weber.

<u>Given the following data:</u>

  • Emf = 520 Volts
  • Speed = 660 r.p.m
  • Number of armature conductors = 144 slots
  • Number of poles = 4 poles
  • Number of parallel paths = 2

To find the magnetic flux per pole:

Mathematically, the emf generated by a DC generator is given by the formula;

E = \frac{\theta ZN}{60} × \frac{P}{A}

<u>Where:</u>

  • E is the electromotive force in the DC generator.
  • Z is the total number of armature conductors.
  • N is the speed or armature rotation in r.p.m.
  • P is the number of poles.
  • A is the number of parallel paths in armature.
  • Ф is the magnetic flux.

First of all, we would determine the total number of armature conductors:

Z = 144 × 2 × 3

Z = 864

Substituting the given parameters into the formula, we have;

520 = \frac{\theta (864)(660)}{60} × \frac{4}{2}

520 = \theta (864)(11) × 2

520 = 19008 \theta \\\\\Theta = \frac{520}{19008}

<em>Magnetic flux </em><em>=</em><em> 0.0274 Weber.</em>

Therefore, the magnetic flux per pole is 0.0274 Weber.

Read more: brainly.com/question/15449812?referrer=searchResults

5 0
2 years ago
For some metal alloy, a true stress of 345 MPa (50040 psi) produces a plastic true strain of 0.02. How much will a specimen of t
Strike441 [17]

Answer:

the elongation of the metal alloy is 21.998 mm

Explanation:

Given the data in the question;

K = σT/ (εT)ⁿ

given that metal alloy true stress σT = 345 Mpa, plastic true strain εT = 0.02,

strain-hardening exponent n = 0.22

we substitute

K = 345 / 0.02^{0.22

K = 815.8165 Mpa

next, we determine the true strain

(εT) = (σT/ K)^1/n

given that σT = 412 MPa

we substitute

(εT) = (412 / 815.8165 )^(1/0.22)

(εT) = 0.04481 mm

Now, we calculate the instantaneous length

l_i = l_0e^{ET

given that l_0 = 480 mm

we substitute

l_i =480mm × e^{0.04481

l_i =  501.998 mm

Now we find the elongation;

Elongation = l_i - l_0

we substitute

Elongation = 501.998 mm - 480 mm

Elongation = 21.998 mm

Therefore, the elongation of the metal alloy is 21.998 mm

6 0
2 years ago
Drivers education - Unit 3
melamori03 [73]

The following scenarios are pertinent to driving conditions that one may encounter. See the following rules of driving.

<h3>What do you do when the car is forced into the guardrail?</h3>

Best response:

  • I'll keep my hands on the wheel and slow down gradually.
  • The reason I keep my hands on the steering wheel is to avoid losing control.
  • This will allow me to slowly back away from the guard rail.
  • The next phase is to gradually return to the fast lane.
  • Slamming on the brakes at this moment would result in a collision with the car behind.

Scenario 2: When driving on a wet road and the car begins to slide

Best response:

  • It is not advised to accelerate.
  • Pumping the brakes is not recommended.
  • Even lightly depressing and holding down the brake pedal is not recommended.
  • The best thing to do is take one foot off the gas pedal.
  • There should be no severe twists at this time.

Scenario 3: When you are in slow traffic and you hear the siren of an ambulance behind

Best response:

  • The best thing to do at this moment is to go to the right side of the lane and come to a complete stop.
  • This helps to keep the patient in the ambulance alive.
  • It also provide a clear path for the ambulance.
  • Moving to the left is NOT recommended.
  • This will exacerbate the situation. If there is no place to park on the right shoulder of the road, it is preferable to stay in the lane.

Learn more about rules of driving. at;

brainly.com/question/8384066

#SPJ1

4 0
2 years ago
Other questions:
  • For each of the following stacking sequences found in FCC metals, cite the type of planar defect that exists:
    7·1 answer
  • (35 points) This is a legit question that I have for a device FOR my homework.
    12·1 answer
  • Air,in a piston cylinder assembly, is initially at 300 K and 200 kPa.It is then heated at constant pressure to 600 K. Determine
    12·2 answers
  • A square power screw has a mean diameter of 30 mm and a pitch of 4 mm with single thread. The collar diameter can be assumed to
    14·1 answer
  • The x component of velocity in an incompressible flow field is given by u = Ax, where A = 2 s-1 and the coordinates are measured
    10·1 answer
  • In a flow over a flat plate, the Stanton number is 0.005: What is the approximate friction factor for this flow a)- 0.01 b)- 0.0
    8·1 answer
  • A flashed steam geothermal power plant is located where underground hot water is available as saturated liquid at 700 kPa. The w
    14·1 answer
  • The difference in potential energy between an electron at the negative terminal and one at the positive terminal is called the _
    11·1 answer
  • The van der Waals equation is a modification of the ideal gas equation. What two factors does this equation account for? A. (1)
    6·1 answer
  • Which of the following about valence electron is correct?
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!