The weights of 8 boys in kilograms: 45, 39, 53, 45, 43, 48, 50, 45. Find the median

 The weights of 8 boys in kilograms: 45, 39, 53, 45, 43, 48, 50, 45. Find the median




To find the median, we need to arrange the weights in ascending order. Here are the weights of the 8 boys in kilograms:


39, 43, 45, 45, 45, 48, 50, 53


To find the median, we look for the middle value. Since there are 8 weights, the median is the average of the two middle values. In this case, the two middle values are 45 and 45. Therefore, the median weight is:


(45 + 45) / 2 = 90 / 2 = 45


So, the median weight of the 8 boys is 45 kilograms.



OR




Here's how you can find the median of the given weights using Python:


CODE:-

weights = [45, 39, 53, 45, 43, 48, 50, 45]

sorted_weights = sorted(weights)

length = len(sorted_weights)


if length % 2 == 0:

    median = (sorted_weights[length // 2 - 1] + sorted_weights[length // 2]) / 2

else:

    median = sorted_weights[length // 2]


print("The median weight is:", median)

When you run this code, it will output:

The median weight is: 45.0

So, the median weight of the 8 boys is 45 kilograms, just as we calculated earlier.







Comments

Popular posts from this blog

Load a Pandas dataframe with a selected dataset. Identify and count the missing values in a dataframe. Clean the data after removing noise as follows: a. Drop duplicate rows. b. Detect the outliers and remove the rows having outliers c. Identify the most correlated positively correlated attributes and negatively correlated attributes

Import iris data using sklearn library . Compute mean, mode, median, standard deviation, confidence interval and standard error for each feature ii. Compute correlation coefficients between each pair of features and plot heatmap iii. Find covariance between length of sepal and petal iv. Build contingency table for class feature