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]
3 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]3 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
Write explicit formula for a1=3, r=-2; then generate 1st 5 terms
Crazy boy [7]

Answer:

  • an = 3(-2)^(n-1)
  • 3, -6, 12, -24, 48

Step-by-step explanation:

These variable names, a1, r, are commonly used in relationship to geometric sequences. We assume you want the terms of a geometric sequence with these characteristics.

a1 is the first term. r is the ratio between terms, so is the factor to find the next term from the previous one.

  a1 = 3  (given)

  a2 = a1×r = 3×(-2) = -6

  a3 = a2×r = (-6)(-2) = 12

  a4 = a3×r = (12)(-2) = -24

  a5 = a4×r = (-24)(-2) = 48

The first 5 terms are 3, -6, 12, -24, 48.

__

The explicit formula for the terms of a geometric sequence is ...

  an = a1×r^(n -1)

Using the given values of a1 and r, the explicit formula for this sequence is ...

  an = 3(-2)^(n -1)

6 0
3 years ago
Write a function rule that gives the total cost c(p) of p pounds of sugar if each pound costs $0.42.
julia-pushkina [17]
Since a pound of sugar increases proportionally to the total cost of sugar bought, then the function can be written as:

c(p) = 0.42p

Where: c(p) = total cost of sugar bought
p = pounds of sugar

c(p) is a function of p, because c(p) depends on p.
5 0
3 years ago
Read 2 more answers
I need help with this problem plzzz
Effectus [21]

Not sure sorry but you can. Try searching on google or yahoo answers

6 0
3 years ago
A large container holds 4 gallons of chocolate milk that has to be poured into 1-pint bottles. If the ratio of gallons to pints
MrMuchimi
Seen 4 gallons are being turned into pints it easy just need to do 4x8 which = 32 because 1 gallons = 8 pints!
4 0
3 years ago
Read 2 more answers
Find the shaded sector and the length of the arc. Round to the nearest hundredth. ​
Dovator [93]

Answer:

Step-by-step explanation:

I'll show you how to do the first one; the other are exactly the same, so pay attention.

The formula for arc length is

AL=\frac{\theta}{360}*2\pi r where θ is the central angle's measure. It just so happens that the measure of the central angle is the same as the measure of the arc it intercepts. Our arc shows a measure of 40°; this measure is NOT the same as the length. Measures are in degrees while length is in inches, or cm, or meters, etc. Going off that info, our central angle measures 40°. Filling in the formula and using 3.1415 for π:

AL=\frac{40}{360}*2(3.1415)(3). I'm going to reduce that fraction a bit (and I'll use the same reduction in the Area of a sector coming up next):

AL=\frac{1}{9}*2(3.1415)(3) which makes

AL = 2.09 units. Now for Area of the Sector. The formula is almost identical, but instead uses the idea that the area of a circle is πr²:

A_s=\frac{\theta}{360}*\pi r^2 where θ is, again, the measure of the central angle (which is the same as the measure of the arc it intercepts). Filling in:

A_s=\frac{1}{9}*(3.1415)(3)^2 which simplifies a bit to

A_s=\frac{1}{9}*(3.1415)(9). As you can see, the 9's cancel each other out, leaving you with

A_s=3.14 units²

7 0
3 years ago
Read 2 more answers
Other questions:
  • What is the value of Tan θ?
    10·1 answer
  • Identify the graphed linear equation.
    10·2 answers
  •  I need help I don't understand this?
    9·1 answer
  • If the perimeter of the regular hexagon shown above is 78 centimeters, what is the length of each side?
    15·1 answer
  • What characteristic below distinguishes a quantitative research question from a research hypothesis? Group of answer choices One
    5·2 answers
  • What is the constant difference of the above sequence 6;10;14​
    9·1 answer
  • -3(3а - 8) = -3<br>solve for a and show your work ​
    7·2 answers
  • Taking out common factor<br><img src="https://tex.z-dn.net/?f=16%28e%20-%20w%29%20%20%7B%7D%5E%7B2%7D%20%20%2B%204%28e%20-%20w%2
    13·1 answer
  • A weight-loss clinic advertised that last month its patients, on average,8lb lost . Assuming that average refers to the mean, wh
    13·2 answers
  • PLEASE HELP!! 50 POINTS!!!!!
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!