Challenge - 5 Problems
Descriptive Statistics Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Calculate mean and median from a list
What is the output of the following code that calculates the mean and median of a list of numbers?
Data Analysis Python
import statistics numbers = [10, 20, 30, 40, 50] mean_val = statistics.mean(numbers) median_val = statistics.median(numbers) print(mean_val, median_val)
Attempts:
2 left
💡 Hint
Mean is the average, median is the middle value when sorted.
✗ Incorrect
The mean is the sum of all numbers divided by count: (10+20+30+40+50)/5 = 30. The median is the middle number in sorted order, which is 30.
❓ data_output
intermediate2:00remaining
Count unique values in a DataFrame column
Given a DataFrame with a column of colors, what is the output of counting unique values in that column?
Data Analysis Python
import pandas as pd data = {'color': ['red', 'blue', 'red', 'green', 'blue', 'blue']} df = pd.DataFrame(data) unique_counts = df['color'].value_counts() print(unique_counts)
Attempts:
2 left
💡 Hint
Count how many times each color appears.
✗ Incorrect
The color 'blue' appears 3 times, 'red' 2 times, and 'green' once. value_counts() sorts by count descending by default.
❓ visualization
advanced3:00remaining
Identify the correct boxplot visualization
Which option shows the correct boxplot for the data [5, 7, 8, 12, 15, 18, 22]?
Data Analysis Python
import matplotlib.pyplot as plt data = [5, 7, 8, 12, 15, 18, 22] plt.boxplot(data) plt.show()
Attempts:
2 left
💡 Hint
Median is the middle value; whiskers cover min and max if no outliers.
✗ Incorrect
The median of the data is 12. The minimum is 5 and maximum is 22. No values are far enough to be outliers, so whiskers span min to max.
🧠 Conceptual
advanced1:30remaining
Understanding standard deviation effect
If two datasets have the same mean but one has a larger standard deviation, what does this mean about the data?
Attempts:
2 left
💡 Hint
Think about how spread out the numbers are around the average.
✗ Incorrect
Standard deviation measures how much values differ from the mean. Larger standard deviation means more spread out values.
🔧 Debug
expert2:00remaining
Identify the error in variance calculation code
What error does the following code raise when calculating variance of a list?
Data Analysis Python
data = [4, 8, 15, 16, 23, 42] variance = sum((x - sum(data)/len(data))**2 for x in data) / (len(data) - 1) print(variance)
Attempts:
2 left
💡 Hint
Check if denominator is zero and if sum() is used correctly.
✗ Incorrect
The code correctly calculates sample variance using the formula. len(data) is 6, so denominator is 5, no division by zero. sum() is used correctly.