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 furnace wall is to be built of 20-cm firebrick and building (structural) brick of same thickness. The thermal conductivities o
Norma-Jean [14]

Answer:

q=2313.04W/m^2

T=690.86°C

Explanation:

Given that

Thickness t= 20 cm

Thermal conductivity of firebrick= 1.6 W/m.K

Thermal conductivity of structural brick= 0.7 W/m.K

Inner temperature of firebrick=980°C

Outer temperature of structural brick =30°C

We know that thermal resistance

R=\dfrac{t}{KA}

These are connect in series

R=\left(\dfrac{t}{KA}\right)_{fire}+\left(\dfrac{t}{KA}\right)_{struc}

R=\dfrac{0.2}{1.6A}+\dfrac{0.2}{0.7A}\ K/W

R=\dfrac{23}{56A}\ K/W

Heat transfer

Q=\dfrac{\Delta T}{R}

Q=56A\times \dfrac{980-30}{23}\ W

So heat flux

q=2313.04W/m^2

Lets temperature between interface is T

Now by equating heat in both bricks

\dfrac{980-T}{\dfrac{0.2}{1.6A}}=\dfrac{T-30}{\dfrac{0.2}{0.7A}}

So T=690.86°C

6 0
3 years ago
Why did you choose agricultural and biosystem as a course? Help me guys
Mazyrski [523]

Answer:

To be able to develop as a human and give back to the community. To ensure that people have safe food and water to drink, clean fuel and energy sources, and in general a safe enviornment to live in.

Explanation:

7 0
3 years ago
A right triangle has a base of 12 inches and a height of 30 inches, what is the centroid of the triangle?​
aliina [53]

Answer:

the correct answer is 42

4 0
3 years ago
A second inventor was driving down the highway in her Prius one day with her hand out the window. She happened to be driving thr
Eva8 [605]

Answer:

Explanation:

It wouldn't work because the wind energy she would be collecting would actually come from the car engine.

The relative wind velocity observed from a moving vehicle is the sum of the actual wind velocity and the velovity of the vehicle.

u' = u + v

While running a car will generate a rather high wind velocity, and increase the power generated by a wind turbine, the turbine would only be able to convert part of the wind energy into electricity while adding a lot of drag. In the end, it would generate less energy that what the drag casuses the car to waste to move the turbine.

Regenerative braking uses an electric generator connected to the wheel axle to recover part of the kinetic energy eliminated when one brakes the vehicle. Normal brakes dissipate this energy as heat, a regenerative brake uses it to recharge a batttery. Note that is is a fraction of the energy that is recovered, not all of it.

A "regenerative accelerator" makes no sense. Braking is taking kinetic energy out of the vehicle, while accelerating is adding kinetic energy to it. Cars accelerate using the power from their engines.

6 0
3 years ago
How does heat conduction differ from convection?
Helga [31]

Explanation:

Conduction:

     Heat transfer in the conduction occurs due to movement of molecule or we can say that due to movement of electrons in the two end of same the body. Generally,  phenomenon of conduction happens in the case of solid . In conduction heat transfer takes places due to direct contact of two bodies.

Convection:

              In convection heat transfer of fluid takes place due to density difference .In simple words we can say that heat transfer occur due to motion of fluid.

7 0
3 years ago
Read 2 more answers
Other questions:
  • What is the maximum thermal efficiency possible for a power cycle operating between 600P'c and 110°C? a). 47% b). 56% c). 63% d)
    15·1 answer
  • A mercury thermometer has a cylindrical capillary tube with an internal diameter of 0.2 mm. If the volume of the thermometer and
    10·1 answer
  • ). A 50 mm diameter cylinder is subjected to an axial compressive load of 80 kN. The cylinder is partially
    8·1 answer
  • Why was information revolution different or unique <br>​
    6·1 answer
  • Which type of Bridge is considered the strongest in both compression and tension?
    11·2 answers
  • 5 kg of a wet steam has a volume of 2 m3
    8·1 answer
  • Find the remaining trigonometric functions of 0 if
    10·1 answer
  • How do you breed a linner?
    5·2 answers
  • Subject : SCIENCE
    12·1 answer
  • Do better then me......................................
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!