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
P9.28 A large vacuum tank, held at 60 kPa absolute, sucks sea- level standard air through a converging nozzle whose throat diame
eimsori [14]

Answer:

a)  m=0.17kg/s

b)  Ma=0.89

Explanation:

From the question we are told that:

Pressure P=60kPa

Diameter d=3cm

Generally at sea level

T_0=288k\\\\\rho_0=1.225kg/m^3\\\\P_0=101350Pa\\\\r=1.4

Generally the Power series equation for Mach number is mathematically given by

\frac{p_0}{p}=(1+\frac{r-1}{2}Ma^2)^{\frac{r}{r-1}}

\frac{101350}{60*10^3}=(1+\frac{1.4-1}{2}Ma^2)^{\frac{1.4}{1.4-1}}

Ma=0.89

Therefore

Mass flow rate

\frac{\rho_0}{\rho}=(1+\frac{1.4-1}{2}(0.89)^2)^{\frac{1.4}{1.4-1}}

\frac{1.225}{\rho}=(1+\frac{1.4-1}{2}(0.89)^2)^{\frac{1.4}{1.4-1}}

\rho=0.848kg/m^3

Generally the equation for Velocity at throat is mathematically given by

V=Ma(r*T_0\sqrt{T_e})

Where

T_e=\frac{P_e}{R\rho}\\\\T_e=\frac{60*10^6}{288*0.842\rho}

T_e=248

Therefore

V=0.89(1.4*288\sqrt{248})\\\\V=284

Generally the equation for Mass flow rate is mathematically given by

m=\rho*A*V

m=0.84*\frac{\pi}{4}*3*10^{-2}*284

m=0.17kg/s

6 0
3 years ago
A rigid tank contains an ideal gas at 40°C that is being stirred by a paddle wheel. The paddle wheel does 240 kJ of work on the
Sergeu [11.5K]

To solve the problem it is necessary to consider the concepts and formulas related to the change of ideal gas entropy.

By definition the entropy change would be defined as

\Delta S = C_p ln(\frac{T_2}{T_1})-Rln(\frac{P_2}{P_1})

Using the Boyle equation we have

\Delta S = C_p ln(\frac{T_2}{T_1})-Rln(\frac{v_1T_2}{v_2T_1})

Where,

C_p = Specific heat at constant pressure

T_1= Initial temperature of gas

T_2= Final temprature of gas

R = Universal gas constant

v_1= Initial specific Volume of gas

v_2= Final specific volume of gas

According to the statement, it is an isothermal process and the tank is therefore rigid

T_1 = T_2, v_2=v_1

The equation would turn out as

\Delta S = C_p ln1-ln1

<em>Therefore the entropy change of the ideal gas is 0</em>

Into the surroundings we have that

\Delta S = \frac{Q}{T}

Where,

Q = Heat Exchange

T = Temperature in the surrounding

Replacing with our values we have that

\Delta S = \frac{230kJ}{(30+273)K}

\Delta S = 0.76 kJ/K

<em>Therefore the increase of entropy into the surroundings is 0.76kJ/K</em>

8 0
3 years ago
The density of a certain type of steel is 8.1 g/cm3. What is the mass of a 100 cm3 chunk of this steel
irina1246 [14]

Answer:

  810 g

Explanation:

Mass is the product of density and volume:

  m = ρV

  m = (8.1 g/cm³)(100 cm³) = 810 g

The mass of the chunk is 810 grams.

4 0
2 years ago
Determine the initial void ratio, the relative density and the unit weight (in pounds per cubic foot) of the specimens for each
Elina [12.6K]

The initial void ratio is the <em>parameter </em>which is used to show the structural foundations for each <em>specimen of sand </em>so that the method and speed of compression would be <em>measured</em>.

Relative density is the mass per unit volume of each specimen of sand which is <em>measured </em>and it has to do with the<em> relative ratio</em> of the density of the sand.

Unit weight is the the exact weight per cubic foot of the sand which is measured.

Please note that your question is incomplete so I gave you a general overview to help you better understand the concept

Read more here:

brainly.com/question/15220801

5 0
3 years ago
Find At Least Three Instances Of Set Constructions In Your CS Courses And Use Them To Exhibit All Set Operations Discussed In Cl
hoa [83]

An expertly designed format for arranging, processing, accessing, and storing data is called a data structure.

Data structures come in both simple and complex forms, all of which are made to organize data for a certain use. Users find it simple to access the data they need and use it appropriately thanks to data structures. The organizing of information is framed by data structures in a way that both machines and people can better grasp. A data structure may be chosen or created in computer science and computer programming to store data in order to be used with different methods. In some circumstances, the design of the data structure and the algorithm's fundamental operations are closely related. Each data structure comprises information about the data values, relationships between the data and — in some situations — functions that can be applied to the data. For instance, in an object-oriented programming language, the data structure and its related methods are tied together as part of a class description. Although they may be designed to operate with the data structure in non-object oriented languages, these functions are not considered to be a part of the data structure. A data structure may be chosen or created in computer science and computer programming to store data in order to be used with different methods. In some circumstances, the design of the data structure and the algorithm's fundamental operations are closely related. Each data structure comprises information about the data values, relationships between the data and — in some situations — functions that can be applied to the data.

Know more about data structure here:

brainly.com/question/29487957

#SPJ4

4 0
1 year ago
Other questions:
  • Consider a vortex filament of strength in the shape of a closed circular loop of radius R. Obtain an expression for the velocity
    10·1 answer
  • What is temperature coefficient of resistance
    12·1 answer
  • A non-entrepreneurship, work-based, agricultural type of SAE, in which a student learns and gains skills in a paid or unpaid pos
    15·1 answer
  • Suggest how the following requirements might be rewritten in a
    8·1 answer
  • Electricians will sometimes call ______ "disconnects" or a "disconnecting means."
    15·1 answer
  • The production of carbon dioxide makes it unwise and unsafe to operate a tractor or any motor vehicle inside enclosed spaces suc
    13·1 answer
  • What is a beam on a bridge? what does it do?
    6·1 answer
  • For RTK to work, what do we need besides two or more receivers collecting data from a sufficient number of satellites simultaneo
    11·1 answer
  • This might count as engineering, I'm not sure as this is IT
    8·1 answer
  • Explain how you would solve for total resistance in a parallel circuit versus a series circuit. How would you apply and solve fo
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!