Answer:
The solution is written using Python as it has a simple syntax.
- def getHighScores(gameScores, minScore):
- meetsThreshold = []
- for score in gameScores:
- if(score > minScore):
- meetsThreshold.append(score)
- return meetsThreshold
- gameScores = [2, 5, 7, 6, 1, 9, 1]
- minScore = 5
- highScores = getHighScores(gameScores, minScore)
- 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().
True, false, false. Hope this helps:)
Answer:
Explanation:
The following code is written in Java and loops through 10 times. Each time generating 2 random dice rolls. If the sum is 10 it breaks the loop and outputs a "You Win" statement. Otherwise, it outputs "You Lose"
import java.util.Random;
class Brainly {
public static void main(String[] args) {
UseRandom useRandom = new UseRandom();
boolean youWin = false;
for (int x = 0; x<10; x++) {
int num1 = useRandom.getRandom(6);
int num2 = useRandom.getRandom(6);
if ((num1 + num2) == 10) {
System.out.println("Number 1: " + num1);
System.out.println("Number 2: " + num2);
System.out.println("You Win");
youWin = true;
break;
}
}
if (youWin == false) {
System.out.println("You Lose");
}
}
}
class UseRandom{
public int getRandom(int n)
{
Random r=new Random();
int rand=r.nextInt(n);
return rand;
}}
Answer: The Internet started in the 1960s as a way for government researchers to share information. ... This eventually led to the formation of the ARPANET (Advanced Research Projects Agency Network), the network that ultimately evolved into what we now know as the Internet.
Have a nice day ahead :)
<span>The person or persons requesting the worksheet should supply their requirements in a requirements document. </span>