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
Sedaia [141]
2 years ago
15

Students in a class are asked to stand in ascending order according to their heights for the annual class photograph. Determine

the number of students not currently standing in their correct positions.Students in a class are asked to stand in ascending order according to their heights for the annual class photograph. Determine the number of students not currently standing in their correct positions.
Mathematics
1 answer:
horrorfan [7]2 years ago
4 0

Answer:

The function in Python is as follows:

def heightChecker(heights):

   expected = []

   count = 0

   for i in range(len(heights)):

       expected.append(heights[i])      

   expected.sort()

   for i in range(len(heights)):

       if expected[i] != heights[i]:

           count+=1  

   return count

Step-by-step explanation:

Required

Function to return the number of out of position students

<em>See comment for complete question</em>

This defines the function. It receives the heights as a parameter, from the main

def heightChecker(heights):

This initializes a list, (expected list)

   expected = []

This initializes the count of out of position students

   count = 0

This iterates through the original list

   for i in range(len(heights)):

The list item is then appended to the expected list

       expected.append(heights[i])      

This sorts the expected list in ascending order

   expected.sort()

This iterates through the original and the expected lists

   for i in range(len(heights)):

If list elements at the same index are not the same, count is incremented by 1

<em>        if expected[i] != heights[i]: </em>

<em>            count+=1  </em>

This returns count

   return count

You might be interested in
An independent variable is ___. A. directly changed by the experimenter B. manipulated by changes to the dependent variable C. a
Nikitich [7]

Correct answer choice is :


<h2>A) Directly changed by the experimenter</h2><h2 /><h2>Explanation:</h2><h2 />

In mathematical modeling, analytical modeling and experimental sciences, the values of dependent variables depend on the values of independent variables. The dependent variables describe the output or outcome whose change is being examined. An independent variable seldom named an experimental or predictor variable, is a variable that is being formed in an experiment in order to inspect the impact on a dependent variable, sometimes described as an outcome variable.

7 0
3 years ago
Read 2 more answers
Will someone help me with this
Marina CMI [18]

hope this helps :)

.........

3 0
1 year ago
What is 8×∙(−7)∙3 = Because I need it right now for my HOMEWORK, so if you know the answer please tell me what it is.
Romashka [77]

Answer:

-168

Step-by-step explanation:

8 × -7 × 3

-56 × 3

-168

3 0
3 years ago
What are the additive and multiplicative identities for any rational number​
abruzzese [7]

Step-by-step explanation:

  • natural numbers, whole numbers, and integers zero is the additive identity
  • 1 is the multiplicative identity.

in case of rational numbers.

<h2>hope it helps.</h2><h2>stay safe healthy and happy.</h2>
6 0
2 years ago
Nolan and emily are both selling cookie dough for a fundraiser. Although Nolan has already sold four tubes emily hasn't sold any
just olya [345]

Answer:

it will take 65 days. 130 tubes of cookie dough.

Step-by-step explanation:

3 0
3 years ago
Other questions:
  • Is this correct?
    5·1 answer
  • Y = -5x + 3<br> y = 8x – 23
    15·1 answer
  • the height of a parallelogram is 18 centimeters less than its base. if the area is 175 square centimeters, what is its height?
    7·1 answer
  • Which of the following is the equation of a line that passes through the point (3,2) and is parallel to the y-axis? A. x = 2 B.
    14·2 answers
  • Jill earns a yearly salary of $40,000 plus 15% commission on total sales. Shonda earns $55,000 yearly salary plus 10% commission
    10·1 answer
  • The table shows a proportional relationship.
    10·1 answer
  • It’s the red one but tell me why plz now hurry 4 min left
    13·1 answer
  • A group of screwdrivers produced in a day at a particular factory has a defect rate of 0.7%. Suppose a quality inspector randoml
    11·1 answer
  • I need help pls because I am confused.
    6·1 answer
  • Please i need it for now PLSSSS
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!