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
What Is Photosynthesis ?​
Fynjy0 [20]

Answer:

Photosynthesis is a process used by plants and other organisms to convert light energy into chemical energy that, through cellular respiration, can later be released to fuel the organism's activities.

6 0
2 years ago
Read 2 more answers
Why doesn't any one give as many points as i do for random questions on brainly
erastova [34]

good question i like to give about 20. i think people just are cheapskates for most of their time on this planet. didnt need the 50 though but thanks.

4 0
2 years ago
Read 2 more answers
3. If nothing can ever be at absolute zero, why does the concept exist?
Tanzania [10]

The absolute zero in temperature refers to the minimal possible temperature. It is the temperature at which the molecules of a system stop moving, so it is a really useful reference point.

<h3>Why absolute zero can't be reached?</h3>

It would mean that we need to remove all the energy from a system, but to do this we need to interact with the system in some way, and by interacting with it we give it "some" energy.

Actually, from a quantum mechanical point of view, the absolute zero has a residual energy (so it is not actually zero) and it is called the "zero point". This happens because it must meet <u>Heisenberg's uncertainty principle</u>.

So yes, the absolute zero can't be reached, but there are really good approximations (At the moment there is a difference of about 150 nanokelvins between the absolute zero and the smallest temperature reached). Also, there are a lot of investigations near the absolute zero, like people that try to reach it or people that just need to work with really low temperatures, like in type I superconductors.

So, concluding, why does the concept exist?

  • Because it is a reference point.
  • It is the theoretical temperature at which the molecules stop moving, defining this as the <u>minimum possible temperature.</u>

If you want to learn more about the absolute zero, you can read:

brainly.com/question/3795971

3 0
2 years ago
A harmonic oscillator with spring constant, k, and mass, m, loses 3 quanta of energy, leading to the emission of a photon.
Monica [59]

Answer: (a). E = 3.1656×10³⁴ √k/m  

(b). f = 9.246 × 10¹² Hz

(c). Infrared region.

Explanation:

From Quantum Theory,

The energy of a proton is proportional to the frequency, from the equation;

E = hf

where E = energy in joules

h = planck's constant i.e. 6.626*10³⁴ Js

f = frequency

(a). from E = hf = 1 quanta

    f = ω/2π

where ω = √k/m

consider 3 quanta of energy is lost;

E = 3hf = 3h/2π × √k/m

E = (3×6.626×10³⁴ / 2π) × √k/m

E = 3.1656×10³⁴ √k/m    

(b). given from the question that K = 15 N/m

and mass M = 4 × 10⁻²⁶ kg

To get the frequency of the emitted photon,

Ephoton =hf = 3h/2π × √k/m (h cancels out)

f = 3h/2π × √k/m

f =  3h/2π × (√15 / 4 × 10⁻²⁶ )

f = 9.246 × 10¹² Hz

(c). The region of electromagnetic spectrum, the photon belongs to is the Infrared Spectrum because the frequency ranges from about 3 GHz to  400 THz in the electromagnetic spectrum.

6 0
3 years ago
What was the first roblox player A.bob B.roblox C.builderman
san4es73 [151]
Builderman is dksbdkbsnsbs
5 0
3 years ago
Read 2 more answers
Other questions:
  • A six-lane freeway (three lanes in each direction) currently operates at maximum LOS C conditions. The lanes are 11 ft wide, the
    5·1 answer
  • Harmony in music is characterized by _____.
    14·2 answers
  • A 100-mm-diameter cast Iron shaft is acted upon by a 10 kN.m bending moment, a 8 kN.m torque, and a 150 kN axial force simultane
    9·1 answer
  • Consider a steady-state experiment in which the observed current due to reduction of Ox to R is 85 mA/cm2. What is the concentra
    12·1 answer
  • Which substance(s) have no fixed shape and no fixed volume?
    5·2 answers
  • Consider the following signal:
    8·1 answer
  • I will put other link in comments
    12·1 answer
  • A tiger cub has a pattern of stripes on it for that is similar to that of his parents where are the instructions stored that pro
    8·1 answer
  • Which type of line is represented by thin, short dashes?
    9·1 answer
  • 8th grade safety test
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!