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]
3 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]3 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]3 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
The highly advanced decision support feature integrated within an electronic information system would support which activity?
vlabodo [156]
Flash would be the option
7 0
3 years ago
business owners and managers may first balk at the idea of mobile officer workers because there may appear to be a lack of ___ w
Tcecarenko [31]
Business owners and managers may first balk at the idea of mobile officer workers because there may appear to be a lack of ___ when employees are not sitting at a desk in the office

Lack of control, supervision (I.e. micro-management lol).
5 0
3 years ago
Suppose you are using a Mac to read your e-mail messages, and you receive an
Gekata [30.6K]

Answer:

D

Explanation:

4 0
3 years ago
Read 2 more answers
Which option is the default when creating appointments and meetings in a user’s own calendar as it relates to Free/Busy informat
Vlad1618 [11]

Answer:

C !

Explanation:

7 0
3 years ago
WRITE A PROGRAM TO CALCULATE SIMPLE INTEREST
Alchen [17]

The simple interset program is a sequential program, and does not require loops and conditions

The simple interset program in Python, where comments are used to explain each line is as follows:

#This gets input for the principal amount

P = int(input("P = "))

#This gets input for the rate

R = int(input("R = "))

#This gets input for the number of years

N = int(input("N = "))

#This calculates the simple interest

I = P * R * T * 0.01

#This prints the simple interest

print("Simple Interest =",I)

Read more about simple interest at:

brainly.com/question/2294792

7 0
2 years ago
Other questions:
  • Molly wants to make some cells in her balance spreadsheet different colors so that she can more quickly find important data. Wha
    13·2 answers
  • If a database named Contacts has a table named tblEmployees and another database named Orders links to that tblEmployees table,
    8·1 answer
  • What are the different components of the cloud architecture?
    5·2 answers
  • Jason is creating a web page for his school's basketball team. He just finished creating his storyboard. Which tool should he us
    6·2 answers
  • Is 5g harmful to the body ?
    9·2 answers
  • Boardman College maintains two files—one for Sociology majors and another for Anthropology majors. Each file contains students'
    5·1 answer
  • Oiê gentee, bom dia O que você entende por cultura digital ??
    12·1 answer
  • What happens when a dataset includes records with missing data?
    9·1 answer
  • Charlie makes pizza at a restaurant. The customers always compliment how great the pizza tastes. But Charlie takes a long time t
    7·2 answers
  • TIMED QUIZ
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!