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
Nady [450]
2 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]2 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
In which of the following branches of engineering is the practice not restricted?
fgiga [73]

Answer:

a) civil engineering.

Explanation:

Civil engineering is a professional engineering program that deals with the construction, design, and maintenance of all the natural and man-made environments including dams, buildings, railways, and roads.

Civil engineering is the branch of engineering that is the practice not restricted because civil engineer is not restricted to academic profession but practice in designing and construction can make someone a professional civil engineer.

Hence, the correct answer is "a)."

6 0
2 years ago
Read 2 more answers
Universal Containers has a junction object called "Job Production Facility". With 2 master-detail relationships to the Job and P
alexdok [17]

Answer:

C. The user will not be able to see the junction object records or the field values.

Explanation:

For the profile of the user to give access permission such as create and read to the job without granting access permission to the production facility object, the value of the field or records of the junction object will not be seen by the user. This is one of the necessary criteria or principle for the universal container with a junction object.

3 0
2 years ago
Shops should avoid purchasing any material sold in ____________.
snow_lady [41]

Answer: Aerosol Cans

Explanation: I just did the quiz

7 0
2 years ago
or a metal pipe used to pump tomato paste, the overall heat- transfer coefficient based on internal area is 2 W/(m2 K). The insi
igomit [66]

Answer: ok the best one would be letter s because it goes

Explanation:

467,,mm tubing should do

7 0
2 years ago
What is the PW (at i 5%) of SuperTool's new test equipment? The development cost is $1.2M. Net revenues will begin at $300,000 f
lesya692 [45]

Answer:

The Net Present Worth at i 5% of Super Tools new test equipment is -$33,992.45

Explanation:

I calculated the net present based on cash flow projections that $300000 in years 1 and 2 ,declining by $50000 every year and it terminated year 8 with zero cash inflow.

I then discounted the cash flows using discounting factor calculated as (1+i)^n where i is the interest rate of 5% given as the n is the relevant year of cash flow.

Find details in the attached.

Download xlsx
6 0
2 years ago
Other questions:
  • A 20 mm 3 20 mm silicon chip is mounted such thatthe edges are flush in a substrate. The substrate provides anunheated starting
    5·1 answer
  • Create a program named PaintingDemo that instantiates an array of eight Room objects and demonstrates the Room methods. The Room
    10·1 answer
  • A congested computer network has a 0.005 probability of losing a data packet and packet losses are independent events. A lost pa
    12·1 answer
  • A gas turbine operates with a regenerator and two stages of reheating and intercooling. Air enters this engine at 14 psia and 60
    11·1 answer
  • A plate of an alloy steel has a plane-strain fracture toughness of 50 MPa√m. If it is known that the largest surface crack is 0.
    12·1 answer
  • A mixture of air and methane is formed in the inlet manifold of a natural gas-fueled internal combustion engine. The mole fracti
    14·1 answer
  • 1. A four-lane freeway (two lanes in each direction) is located on rolling terrain and has 12-ft lanes, no lateral obstructions
    7·1 answer
  • (a) What is the distinction between hypoeutectoid and hypereutectoid steels? (b) In a hypoeutectoid steel, both eutectoid and pr
    7·2 answers
  • DNA isolated from water samples collected in six different sites was prepared and analyzed by gel electrophoresis for the presen
    12·1 answer
  • For laminar flow of air over a flat plate that has a uniform surface temperature, the curve that most closely describes the vari
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!