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
murzikaleks [220]
4 years ago
11

Write a for loop that sets each array element in bonusScores to the sum of itself and the next element, except for the last elem

ent which stays the same. Be careful not to index beyond the last element. Ex: If bonusScores = [10, 20, 30, 40], then after the the loop bonusScores = [30, 50, 70, 40] The first element is 30 or 10 + 20, the second element is 50 or 20 + 30, and the third element is 70 or 30 + 40. The last element remains the same.

Computers and Technology
2 answers:
Lilit [14]4 years ago
7 0

Answer:

#Python

1. bonusScores = [10, 20, 30, 40]

2. print("Before",bonusScores)

3. for i in range(len(bonusScores)-1):

4.     bonusScores[i] = bonusScores[i] + bonusScores[i+1]

5. print("After",bonusScores)

Explanation:

  1. On the first line, we define our array bonusScores
  2. On line two we print how this array looks like before making any changes
  3. On line 3 we create a for loop to iterate over the length of the array omitting the last element (len(bonusScores)-1)
  4. On line four we sum the current element with the next one
  5. On line five we print the final result

Lesechka [4]4 years ago
3 0

Answer:

The C program is commented in the explanation

Explanation:

I am going to write a C program, a function that receives an array and the array length.

I can update each position with a for loop. This loop is going to end at the next to lastPosition(so, i < n-1);

void sum(int * bonusScores, int n){

int i;

for(i = 0; i < n-1; i++){

bonusScores[i] = bonusScores[i] + bonusScores[i+1]

}

}

This should do it :)

You might be interested in
He following is a string of ASCII characters whose bit patterns have been converted into hexadecimal for compactness: 4A EF 68 6
almond37 [142]

Answer:

a) Please see below as the answer is self explanatory.

b) odd parity.

Explanation:

As the hexadecimal system, has as its base the decimal 16, which is the 4th power of 2 (base of the binary system), each hexadecimal digit can be expressed of a linear combination of 4 binary digits, as follows:

Hex = b₃*2³ + b₂*2² + b₁*2¹ + b₀*2⁰, where bₙ = 0 or 1.

So, we can convert the hexadecimal bit pattern to binary, as follows:

4A = 01001010

Now, if the leftmost bit is a parity bit, the ASCII code is represented by the 7 rightmost bits:

⇒ ASCII = 1001010 = 74

Repeating the same process for the remaining pairs of hex digits, we have:

EF = 11101111 ⇒ ASCII = 1101111  = 111

68 = 01101000 ⇒ ASCII = 1101000 = 104

20 = 00100000 ⇒ ASCII = 0100000 = 32

C4 = 11000100 ⇒ ASCII = 1000100 = 68

EF = 11101111 ⇒ ASCII = 1101111  = 111

E5 = 11100101 ⇒ ASCII = 1100101 = 101

b) Due to any pair of digits has an odd number of 1s, the parity used is odd parity.

7 0
3 years ago
Can you help me match the ships to the right number?​
valina [46]

Answer:

is not clear so if u ca make it a lil bit visible ima help u out

Explanation:

sorry

4 0
3 years ago
An objective test or measurement that technology product evaluators use to compare two or more products is ____.
Crazy boy [7]
<span>An objective test or measurement that technology product evaluators use to compare two or more products is benchmark. The benchmark is set of standards which are used to compare two products. Several parameters are measured in order to compare the products and to define the weak points where improvements can be done. The obtained information form the test is used to improve performance. </span>
4 0
3 years ago
Who prime minister of india​
Alex777 [14]
<h3>\mathfrak\red{✨ Answer :-}</h3>

Mr. Narendra modi is a prime Minister of Indian.

8 0
3 years ago
Read 2 more answers
Which is NOT a reason to study science?
VMariaS [17]
Hi!

Science is a way of thinking about the natural world. It asks thought provoking questions and investigates deep into the human mind, our Earth, our periodic table, or our cosmos.

It's a vast field, with a myriad of career options. Scientists want to learn more about how our natural world works, and experiment to discover newfound facts about life as we know it.

Not to <em>blow... </em>away... your... expectations... but, in science, we rarely blow up things. If you're interested in seeing explosions, go apply to be a myth buster.

Hopefully, this helps! =)
8 0
4 years ago
Other questions:
  • In a case where electrical current leakage from the circuit occurs,
    7·2 answers
  • To help determine which technology to use, Raul creates a table to help him compare the pros and cons of his choices. What part
    15·1 answer
  • A user can easily move to the end of a document by pressing the _____ key combination.
    10·2 answers
  • write a program that converts a Fahrenheit temperature to Celsius. The design of this program is important as I want you to brea
    14·1 answer
  • Which virus-infecting components are email messages prone to carry?
    8·2 answers
  • _______ memory allows data to be both read from and written to easily and rapidly.
    7·1 answer
  • Can someone please help me on these short short questions marking Brainly computer modeling people please help
    14·1 answer
  • In the Microsoft Office Suite, what tells a database what to insert information in the document? 
    8·1 answer
  • You are not sure if a certain word has an"e"at the end<br>​
    11·1 answer
  • What’s the highest stock today?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!