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
The first step to merging is entering the ramp and _____.
Yuri [45]

Answer:

D.telling your passengers where you are going

7 0
3 years ago
A horizontal 2-m-diameter conduit is half filled with a liquid (SG=1.6 ) and is capped at both ends with plane vertical surfaces
luda_lava [24]

Answer:

Resultant force = 639 kN and it acts at 0.99m from the bottom of the conduit

Explanation:

The pressure is given as 200 KPa and the specific gravity of the liquid is 1.6.

The resultant force acting on the vertical plate, Ft, is equivalent to the sum of the resultant force as a result of pressurized air and resultant force due to oil, which will be taken as F1 and F2 respectively.

Therefore,

Ft = F1 + F2

According to Pascal's law which states that a change in pressure at any point in a confined incompressible fluid is transmitted throughout the fluid such that the same change occurs everywhere, the air pressure will act on the whole cap surface.

To get F1,

F1 = p x A

= p x (πr²)

Substituting values,

F1 = 200 x π x 1²

F1 = 628.32 kN

This resultant force acts at the center of the plate.

To get F2,

F2 = Π x hc x A

F2 = Π x (4r/3π) x (πr²/2)

Π - weight density of oil,

A - area on which oil pressure is acting,

hc - the distance between the axis of the conduit and the centroid of the semicircular area

Π = Specific gravity x 9.81 x 1000

Therefore

F2 = 1.6 x 9.81 x 1000 x (4(1)/3π) x (π(1)²/2)

F2 = 10.464 kN

Ft = F1 + F2

Ft = 628.32 + 10.464

Ft = 638.784 kN

The resultant force on the surface is 639 kN

Taking moments of the forces F1 and F2 about the centre,

Mo = Ft x y

Ft x y = (F1 x r) + F2(1 - 4r/3π)

Making y the subject,

y = (628.32 + 10.464(1 - 4/3π)/ 638.784

y = 0.993m

7 0
3 years ago
What is the definition of insert view and why do we use it
maw [93]

Answer:

its a view point for auto cad

Explanation:

from my knowlege in IED we learned about it as a way of sing how an object would look in inventor or auto CAD

4 0
2 years ago
7. Sockets internal designs come in what sizes?
MAXImum [283]

Answer:

These drive fittings come in four common sizes: 1⁄4 inch, 3⁄8 inch, 1⁄2 inch, and 3⁄4 inch (referred to as "drives", as in "3⁄8 drive").

3 0
2 years ago
It is true about Metals and alloys: a)-They are good electrical and thermal conductors b)-They can be used as semi-conductors c)
ycow [4]

Answer:

(d) a and c are correct

Explanation:

METALS : Metal are those materials which has very high ductility, high modulus of elasticity, good thermal and electrical conductivity

for example : iron, gold ,silver, copper

ALLOYS: Alloys are those materials which are made up of combining of two or more than two metals these also have good thermal and electrical conductivity and me liable property

for example ; bronze and brass

so from above discussion it is clear that option (d) will be the correct option

8 0
3 years ago
Read 2 more answers
Other questions:
  • Which of the following is not true about Machine Learning?Machine Learning was inspired by the learning process of human beings.
    11·1 answer
  • In order to build a skyscraper Builders, Inc. hires 400 construction workers and 50 managers. Builders, Inc. represents A entrep
    8·1 answer
  • why HF (hydrogen fluoride) has higher boiling temperature than HCl (hydrogen chloride), even thought HF has lower molecular weig
    8·1 answer
  • Ok I need a new laptop but I'm not sure which one. The Surface laptop 3 is better in many fields like the camera, speaker, audio
    14·1 answer
  • A water contains 50.40 mg/L as CaCO3 of carbon dioxide, 190.00 mg/L as CaCO3 of Ca2 and 55.00 mg/L as CaCO3 of Mg2 . All of the
    5·2 answers
  • Can U lose a rank in Brainly by using too many points?
    6·1 answer
  • To do you blur text in google docs
    10·1 answer
  • Stress that acts in the plane of a cut section, rather than at right angles to the section is called:_______
    6·1 answer
  • Find the remaining trigonometric function of 0 if
    13·1 answer
  • Drivers must be careful when driving close to cyclists and should keep at least ___ feet apart when passing cyclists on the road
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!