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]
3 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]3 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
The dfs replication engine uses a form of replication called
polet [3.4K]
<span>The DFS replication engine uses a form of replication called </span>multiple master replication
3 0
3 years ago
How many bit make a byte .​
Sauron [17]

Answer:

It is easy .8 bits.You have to note this

7 0
3 years ago
Read 2 more answers
How do transformers work?
Umnica [9.8K]
A transformer will either step up or down to the necassary voltage using a core wrapped in a coil of wires.
8 0
3 years ago
Read 2 more answers
Help!!! Photography class!! ASP
katovenus [111]

Answer:

D.

Explanation:

Typically represented by a capital A (or sometimes Av, short for Aperture Value) on the camera mode dial, aperture priority allows the photographer to dial in this specific exposure setting—the ƒ-stop—and asks the camera to calculate the correct corresponding shutter speed in the instant before the shutter is released.

8 0
3 years ago
Mrs. Patel uses a computer program to balance her checkbook. Which of the following best explains how the
Alexandra [31]

Answer:

c it reduces errors

Explanation:

Instead of Mrs.Patel doing it she has an online program made for checks to do it for her.

6 0
3 years ago
Other questions:
  • friend wanted us to decode this message ----- .---- ----- ----- .---- ----- ----- .---- / ----- .---- .---- .---- ----- .---- .-
    11·1 answer
  • Discuss and compare shared and switch Ethernet
    12·1 answer
  • What is the target audience for this poster?
    5·2 answers
  • In modern web design, color, font, font size, and style should be declared using:
    5·1 answer
  • Stored information about a previous visit to a web site is called information _____.
    10·1 answer
  • When entering a expressway using a weave lane you must do what
    7·1 answer
  • Who would win in a fight iron man or bat man​
    5·2 answers
  • Correct single error in this. Try to appear relaxed, but not to relaxed​
    13·1 answer
  • Please please help I don’t understand this please.
    11·1 answer
  • Question
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!