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
How does a router handle a packet destined for a network that is not listed in the routing table?
kogti [31]
The packet is dropped or discarded. By default, a router will send packets to a network that has been listed in the routing table. If it happens that the network is not listed, the packet will be discarded or dropped. Packets that do not have a default route or gateway of last resort are dropped.

 






5 0
3 years ago
Calculate the weighted grade for each student that appears in the data file. You may calculate the grade based on total earned p
lutik1710 [3]

Answer:

I don't know the answer, sorry

6 0
3 years ago
HELP ME PLEASE!!!!!!!!!!!!
Mila [183]

Answer:

b b isss the right answer

5 0
2 years ago
Read 2 more answers
•
Natali [406]

Answer:

ion k srry

Explanation:

3 0
3 years ago
How to remove duplicates from list in python?
kondaur [170]
<span> the new way of </span>removing duplicates<span> from an iterable while keeping it in the original order </span>
5 0
3 years ago
Read 2 more answers
Other questions:
  • If necessary, create a new project named Advanced19 Project, and save it in the Cpp8\Chap06 folder. Enter (or copy) the instruct
    15·1 answer
  • Which pattern is produced by the following code? for (int i = 1; i &lt;= 6; i++) { for (int j = 6; j &gt;= 1; j--) System.out.pr
    6·1 answer
  • True or False: It is illegal to park in a location that you block or create a hazard for other vehicles.
    11·2 answers
  • The hexadecimal number system uses alphabets A to F to represent values_ to _
    12·2 answers
  • The merge sort algorithm sorts using what technique?
    8·1 answer
  • python Which data type is the best choice to store the number of wins associated with each basketball team in the NBA
    12·2 answers
  • Maria is conducting a security investigation and has identified a suspect. The suspect is an employee of the organization who ha
    15·1 answer
  • • Do you think documentaries are best delivered in media such as films or documentary?
    10·1 answer
  • Difine the term pigment​
    14·3 answers
  • Advantages of using Unicode to represent data
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!