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
castortr0y [4]
2 years ago
15

Row array gameScores contains all player scores. Construct a row array highScores than contains all player scores greater than m

inScore. Hint: meetsThreshold is a logic array that indicates which elements in gameScores are greater than minScore.
Ex: If gameScores is [2, 5, 7, 6, 1, 9, 1] and minScore is 5, then highScores should be [7, 6, 9].

function highScores = GetHighScores(gameScores, minScore)
% gameScores: Array contains all player scores
% minScore: Scores greater than minScore are added to highScores

meetsThreshold = (gameScores > minScore); % Logic array indicates which
% elements are greater than minScore

% Construct a row array highScores containing all player scores greater than minScore
highScores=0;

end;
Computers and Technology
1 answer:
Sever21 [200]2 years ago
8 0

Answer:

The solution is written using Python as it has a simple syntax.

  1. def getHighScores(gameScores, minScore):
  2.    meetsThreshold = []
  3.    for score in gameScores:
  4.        if(score > minScore):
  5.            meetsThreshold.append(score)
  6.    return meetsThreshold
  7. gameScores = [2, 5, 7, 6, 1, 9, 1]
  8. minScore = 5
  9. highScores = getHighScores(gameScores, minScore)
  10. print(highScores)

Explanation:

Line 1-8

  • Create a function and name it as <em>getHighScores</em> which accepts two values, <em>gameScores</em> and <em>minScore</em>. (Line 1)
  • Create an empty list/array and assign it to variable <em>meetsThreshold</em>. (Line 2)
  • Create a for loop to iterate through each of the score in the <em>gameScores</em> (Line 4)
  • Set a condition if the current score is bigger than the <em>minScore</em>, add the score into the <em>meetsThreshold</em> list (Line 5-6)
  • Return <em>meetsThreshold</em> list as the output

Line 11-12

  • create a random list of <em>gameScores</em> (Line 11)
  • Set the minimum score to 5 (Line 12)

Line 13-14

  • Call the function <em>getHighScores()</em> and pass the<em> gameScores</em> and <em>minScore </em>as the arguments. The codes within the function <em>getHighScores()</em>  will run and return the <em>meetsThreshold </em>list and assign it to <em>highScores.</em> (Line 13)
  • Display <em>highScores</em> using built-in function print().
You might be interested in
Which zone of the ocean is deepest ?
AURORKA [14]
If you mean, where is the ocean deepest, the answer is the Marina Trench. It is south of Japan and has the lowest elevation of -11 000 meters
4 0
3 years ago
Read 2 more answers
1)What is the hydropower resources/energy?
s344n2d4d5 [400]

Answer:

.

Explanation:

.

6 0
3 years ago
Which media device uses the characteristic continuous?
notka56 [123]
The media device that uses characteristics continuous is the Screen.
In Continous characteristic 
is where there is timing relationship between source and destination.
4 0
3 years ago
I need the answer ASAP. I’ll mark brainliest if right
Kisachek [45]

Answer:

copy or repeat

Explanation:

7 0
2 years ago
Differentiate between refraction of light and reflection of light
lapo4ka [179]

Refraction represents a change in the direction of propagation when beams of light encounter a medium with a different density.

Reflection is the return of light to the medium it came from when it encounters a mirror.

3 0
2 years ago
Read 2 more answers
Other questions:
  • How do I connect my CSS file and HTML page together? it's just not wanting to work for me. 
    5·1 answer
  • This type of connection uses radio waves to connect devices on a network.
    15·2 answers
  • What should you do prior to writing your business document?
    11·1 answer
  • In order for Dr. Reynolds to send a CPOE from her office computer system to the computer system at the local hospital, a/an ____
    5·1 answer
  • Henry went to an IT software company for an interview he was offered a position in lower level management which positions could
    11·1 answer
  • If you cause a car accident, which type of insurance will require you to pay the least out of pocket?
    5·2 answers
  • Dan works for an automobile company. He has designed a new model of a car based on an older version. Which technology can he use
    6·1 answer
  • Numerical methods are implementations of mathematical algorithms, but constructed with special consideration for accuracy of sol
    7·1 answer
  • Write a Java program called Decision that includes a while loop to prompt the user to enter 5 marks using the
    12·1 answer
  • How can she change that value so it is reflected in the chart in her presentation?
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!