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
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
A completely reversible heat pump produces heat ata rate of 300 kW to warm a house maintained at 24°C. Theexterior air, which is
Triss [41]

Answer:

Change in entropy S = 0.061

Second law of thermodynamics is satisfied since there is an increase in entropy

Explanation:

Heat Q = 300 kW

T2 = 24°C = 297 K

T1 = 7°C = 280 K

Change in entropy =

S = Q(1/T1 - 1/T2)

= 300(1/280 - 1/297) = 0.061

There is a positive increase in entropy so the second law is satisfied.

6 0
3 years ago
a stem and leaf display describes two-digit integers between 20 and 80. for one one of the classes displayed, the row appears as
allochka39001 [22]

Answer:

  52, 50, 54, 54, 56

Explanation:

The "stem" in this scenario is the tens digit of the number. Each "leaf" is the ones digit of a distinct number with the given tens digit.

  5 | 20446 represents the numbers 52, 50, 54, 54, 56

8 0
3 years ago
Guess My Favorite Kolor Guys !
bonufazy [111]

Answer: blue

Explanation: blue cuz you look like somebody who likes blue

5 0
3 years ago
Read 2 more answers
Given x = 67 and y = 18, use two's complement to calculate:(1)x+y (2) x-y (3)-x+y (4)-x-y. Do the calculation, show the results
joja [24]

Answer:

See attachment

Explanation:

8 0
3 years ago
Other questions:
  • 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
    9·1 answer
  • The creation of designer drugs is outpacing the ability of society to enact laws to prohibit them. Many of these substances have
    11·1 answer
  • you are planning to buy a new couch for your family room you measure the available space and conclude that the couch should be b
    5·1 answer
  • Please Help !!
    5·1 answer
  • An intelligence signal is amplified by a 65% efficient amplifier before being combined with a 250W carrier to generate an AM sig
    5·1 answer
  • Identify the different engineering activities/steps in the engineering design process for each steps,summarize in 1–3 sentences
    13·1 answer
  • A motor driven water pump operates with an inlet pressure of 96 kPa (absolute) and mass flow rate of 120 kg/min. The motor consu
    7·1 answer
  • What is the most likely reason the rover won't travel in a straight line?
    9·1 answer
  • In order to avoid a rollover, what is the highest degree incline one should mow on? 10-degree incline 5-degree incline 30-degree
    15·1 answer
  • Determine the resistance of 100m of copper cable whose cross-sectional area is 1.5mm2​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!