Question

In: Computer Science

Your task is to calculate the average height of students in the class. You will gather...

Your task is to calculate the average height of students in the class. You will gather each of the student’s height and put it in a list. then you will throw out the shortest and tallest height to take care of any statistical anomalies. Then you will add the heights and divide by the number of student’s in the class.

Heights of Students in inches

Max=77
Josefine=67
Hannah=66
Mia=65
Ben=74
Kevin=70
Marie=64
Aidan=70

Steps On Python:

Declare a list to contain the heights in inches

Ask the user to input values

Add each value to the list

Use appropriate list function to find smallest object

Use appropriate list function to remove that smallest object

Use appropriate list function to find largest object

Use appropriate list function to remove that largest object

Use appropriate list function to add objects in the list,

Then Use appropriate list function to divide that amount by the number of objects in the list

Then print the objects and the average height of students in the class.

Solutions

Expert Solution

********************************************************solution*******************************************************

*Codes , code screenshot, code output screenshot are attached below

----------------------------------------------------CODE-----------------------------------------------------

#list declaration heights
heights=[]
#converting num into int and input number of students
num=int(input("Enter the number of students:"))

#input heights from user
print("Enter the heights of students in inches:")
for i in range(num):
x=int(input("->"))
heights.append(x)
  
#Minimum found using "min" function
Min=min(heights)
#removing Minimum height from the list
heights.remove(Min)

#Maximum found using "max" function
Max=max(heights)
#removing Maximum height from the list
heights.remove(Max)

#total sum of heights
sum=0
for height in heights:
sum=sum+height
  
#average (max and min excluded so thats why (num-2))
average=sum/(num-2)

#printing the objects
print("\nThe remaining heights of the students are :")
for height in heights:
print(height,end=" ")
  
#printing average height
#round function is used to round floats number upto 2 decimal

print("\nThe Average height of the students is "+str(round(average,2)))

----------------------------------------------------CODE SCREENSHOT-----------------------------------------------------

----------------------------------------------------CODE OUTPUT SCREENSHOT-----------------------------------------------------


Related Solutions

The average height for a student in a class with n = 60 students is a...
The average height for a student in a class with n = 60 students is a random variable with an average height of 180 cm and standard deviation σ = 10. The individual heights which make up that average are i.i.d. (1) use Chebyshev’s inequality to find an upper bound for the probability that the average of the class (obtained from the individual student heights) is greater than 200cm. (2) Use Chebyshev’s inequality to upper bound the probability that the...
You would like to study the height of students at your university. Suppose the average for...
You would like to study the height of students at your university. Suppose the average for all university students is 67 inches with a SD of 18 inches, and that you take a sample of 19 students from your university. a) What is the probability that the sample has a mean of 61 or less inches? probability =   b) What is the probability that the sample has a mean between 68 and 71 inches? probability =   Note: Do NOT input...
You would like to study the height of students at your university. Suppose the average for...
You would like to study the height of students at your university. Suppose the average for all university students is 68 inches with a SD of 20 inches, and that you take a sample of 17 students from your university. a) What is the probability that the sample has a mean of 64 or more inches? probability = .204793 (is this answer correct or no? and I need help with part b too.) b) What is the probability that the...
To estimate the mean height μ of male students on your campus, you will measure an...
To estimate the mean height μ of male students on your campus, you will measure an SRS of students. Heights of people of the same sex and similar ages are close to Normal. You know from government data that the standard deviation of the heights of young men is about 2.8 inches. Suppose that (unknown to you) the mean height of all male students is 70 inches. (a) If you choose one student at random, what is the probability that...
10. The grades of students are normal distributed. In a class of 10 students the average...
10. The grades of students are normal distributed. In a class of 10 students the average grade on a quiz is 16.35, with a standard deviation of 4.15. ( 3 marks ) a) Find the 90% confidence interval for the population mean grade. b) If you wanted a wider confidence interval, would you increase or decrease the confidence level?
6 a) You and your friend are in a class with 12 students. For a project,...
6 a) You and your friend are in a class with 12 students. For a project, the class is randomly divided into two equal groups. “Randomly” means all divisions are equally likely. What is the probability that you and your friend end up in the same group? 6 b) Revisit part a). Calculate the probability that you and your friend will end up in the same group if the class is divided into three equal groups instead.
we have a class of 30 students and the data below shows the height (in cm)...
we have a class of 30 students and the data below shows the height (in cm) distribution of those people. The data has already been sorted lowest to highest. 132 151 151 152 156 156 157 160 161 162 163 163 165 167 167 169 171 172 175 175 177 177 178 183 186 189 189 189 197 206 a. Find the 5 number summary b. Draw a Box- and- wisker plot c. Are there any outliers in the data...
In a class of 25 students the average grade on a quiz is 16.85, with a...
In a class of 25 students the average grade on a quiz is 16.85, with a sample standard deviation of 4.75. The grades are known to be normally distributed. a. Determine the standard error of the mean. b. Determine the 98% confidence interval for the class grades. c. If you wanted a narrower interval, would you increase or decrease the confidence level?
Suppose that students own an average of 4 pairs of jeans. 8 people from your class...
Suppose that students own an average of 4 pairs of jeans. 8 people from your class were surveyed to determine if the average for students is higher than 4. DATA TO USE:   2, 2, 3, 4, 6, 6, 8, 9 a. Give the null and alternative hypotheses: Ho: _______________ Ha: ___________________ b. In words, CLEARLY state what your random variable or P' represents. c. State the distribution to use for the test. If t, include the degrees of freedom. If...
One college class had a total of 80 students. The average score for the class on...
One college class had a total of 80 students. The average score for the class on the last exam was 84.3 with a standard deviation of 5.4. A random sample of 34 students was selected. a. Calculate the standard error of the mean. b. What is the probability that the sample mean will be less than 86? c. What is the probability that the sample mean will be more than 85? d. What is the probability that the sample mean...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT